Cannot I import data from a file with multiples delimiters?
Show older comments
Hello,
I have a file called a.txt which has the following format
{"node_id":"a4","Arrived at":"2017-07-04T02:57:06.344971Z","total_Light":66.7959976196289,"S1":0,"S2":0,"S3":0}
{"node_id":"a2","Arrived at":"2017-07-04T02:57:06.344971Z","total_Light":66.7959976196289,"S1":0,"S2":0,"S3":0}
...
I would like to import that data as is being done with the gui import data in Matlab but from the command line, I have searched for importdata however I get an error in such a function saying that it cannot handle multidelimeters, even when the help makes you believe so.
If I invoke the importata over my file a.txt like this,
d = importdata('a.txt',[':',',','}'],1)
I get this error
Error using importdata (line 225)
Unable to load file.
Use TEXTSCAN or FREAD for more complex formats.
Caused by:
Error using importdata>parse (line 309)
Multicharacter delimiters are not supported.
Is it possibe to use importdata to with the multidelimeters or I have to turn to textscan?
Thanks in advance
Accepted Answer
More Answers (1)
Star Strider
on 6 Jul 2017
1 vote
The textscan (link) function allows you to specify multiple delimeters. See the section on 'Delimiter' (link) for details.
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!