Can' read low level file

% 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일

0 개 추천

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개)

카테고리

질문:

2012년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by