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?
답변 (1개)
per isakson
2017년 2월 14일
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}
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!