Can' read low level file

1 回表示 (過去 30 日間)
Rooy
Rooy 2012 年 4 月 14 日
% open the file for reading
fp = fopen(filename,'r');
% get off the header line
fgetl(fp);
%get data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read the data to the specified size
size = fscanf(fp,'%d %f %f %f',[4 inf]);
Mt text file

採用された回答

Walter Roberson
Walter Roberson 2012 年 4 月 14 日
You did not indicate the problem you encountered.
I suggest
fp = fopen(filename, 'r');
datacell = textscan(fp, '%d%f%f%f', 'HeaderLines', 1);
fclose(fp);
Then the month number will be datacell{1}, and the other columns will be datacell{2}, datacell{3}, datacell{4}
  1 件のコメント
Rooy
Rooy 2012 年 4 月 14 日
Thanks for your help, for some reason it did not work yesterday but it works now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by