フィルターのクリア

Index exceeds matrix dimensions.

1 回表示 (過去 30 日間)
Jovos
Jovos 2016 年 2 月 18 日
回答済み: Image Analyst 2016 年 2 月 18 日
Hi, I'm trying to read the raw data from a txt file. Read the file as an array of strings. Then transfer string to num and get the year data. But it shows that the index exceeds matrix dimensions. Anyone help?
filename = input('Please enter the file name: ');
fid01 = fopen(filename,'r');
for i = 6 : 414
line = fgets(fid01);
z = strread(line,'%s');
year = str2num(z{1});
disp(year)
end

採用された回答

Image Analyst
Image Analyst 2016 年 2 月 18 日
Call fgetl() 4 times before the loop to read and throw away the first 4 header lines.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by