How can Specific line and column text file can be read in Matlab?

조회 수: 3 (최근 30일)
Khan Muhammad Adeel Khan
Khan Muhammad Adeel Khan 2020년 7월 9일
답변: Takumi 2020년 7월 10일
Hello!
I want matlab to read the line 4 and column 10 of the attached text file. Kindly guide me how to read the specific line and column?
  댓글 수: 1
Khan Muhammad Adeel Khan
Khan Muhammad Adeel Khan 2020년 7월 9일
편집: Khan Muhammad Adeel Khan 2020년 7월 9일
Thanks for the swift response. I want to save the 1st Quartile value 0.9681 in matlab format.

댓글을 달려면 로그인하십시오.

답변 (1개)

Takumi
Takumi 2020년 7월 10일
fname = 'sub1.txt';
fid = fopen(fname);
% skip 2 lines
for i=1:2
fgetl(fid);
end
str = fgetl(fid); % get specific line
fclose(fid);
num = extractBetween(str,":"," "); % extract numbers
str2num(cell2mat(num)) % convert

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by