Can' read low level file

4 次查看(过去 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 CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by