textscan for text in file

1 回表示 (過去 30 日間)
Jay
Jay 2013 年 4 月 23 日
I have this text in 'DUT_test.dat'
DUT9972,SN1,GUTS7
DUT9972,SN2,GUTS7
DUT9972,SN3,GUTS7
I use this to read this to matlab
>> fid=fopen('DUT_test.dat');
>> c=textscan(fid, '%s,%s,%s');
>> fclose fid;
I cann't have it read correctly.
>> c{1,1}(1,1)
ans =
'DUT9972,SN1,GUTS7'
I suppose to have 1x3 cell array. What is wrong in my code?
Thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 4 月 23 日
c=textscan(fid, '%s%s%s', 'Delimiter', ',');

カテゴリ

Help Center および File ExchangeSurfaces, Volumes, and Polygons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by