Badly formed format string error using textscan
Mostrar comentarios más antiguos
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?
Respuestas (1)
per isakson
el 14 de Feb. de 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}
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!