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

5 ビュー (過去 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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by