Badly formed format string error using textscan
Show older comments
hello
This line is saved in a document called test.txt :
146.557,Yes,Yes,Yes,OE
I tried to import this line using textscan with this code:
fid=fopen('test.txt');
data=textscan(fid,'%f%s%s%s%s%','Delimiter',',');
flcose(fid);
But i only got this error message: "Error using textscan Badly formed format string"
Why does that error message appear? How can i make this code work?
Answers (1)
per isakson
on 14 Feb 2017
Remove the ending "%"
>> data=textscan('146.557,Yes,Yes,Yes,OE','%f%s%s%s%s','Delimiter',',');
>> data
data =
[146.5570] {1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell}
Categories
Find more on Characters and Strings 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!