problem reading entire file with fscanf

3 ビュー (過去 30 日間)
Kristy Hansen
Kristy Hansen 2014 年 10 月 20 日
回答済み: Orion 2014 年 10 月 20 日
Hello,
I am using the code below in Matlab 2014b to read a text file (please see attached) and it stops reading after processing 4 lines. I am not sure where to start with troubleshooting this problem so I hope that someone more experienced than me can assist. Thank you in advance!
ii = 1;
filename = ['data [Anemometer 1]-' num2str(ii) '.txt'];
fh = fopen( filename, 'r' );
for jj=1:5 % ignoring headerlines fgetl(fh); end
data = fscanf( fh, '%*i,%*i,%f,%f,%f,%f,%*s', [4,inf])
fclose(fh);

採用された回答

Orion
Orion 2014 年 10 月 20 日
Hi,
You should use the import Wizard tool to generate a script or function which read your text file the way you need, or at least which returns you a cell array easier to treat (seems you have hexadecimal datas) than the raw file.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by