Badly formed format string error using textscan

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)

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

Tags

Asked:

on 14 Feb 2017

Answered:

on 14 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!