Here i am attaching screenshot of my file which is in .txt format, i have to read the three values (Marked in the screenshot) from the file. Could you please help me in this ??

6 件のコメント

Arun Kumar Singh
Arun Kumar Singh 2020 年 6 月 15 日
i have to read only these three value (marked in the screenshot) from the file.
Walter Roberson
Walter Roberson 2020 年 6 月 15 日
Will it always be the third line? If not then will it always be the GAL line?
Stephan
Stephan 2020 年 6 月 15 日
Please attach the file by using the paperclip button
Arun Kumar Singh
Arun Kumar Singh 2020 年 6 月 15 日
Yes it will always be GAL line. File is attached here.
Walter Roberson
Walter Roberson 2020 年 6 月 15 日
編集済み: Walter Roberson 2020 年 6 月 15 日
fopen(), textscan() with headerlines 2, format '%*s%f%f%f', 'collectoutput', true, and count 1 (the count goes immediately after the format and before any other options.) cell2mat() the result of textscan() to get the numeric data. fclose()
Arun Kumar Singh
Arun Kumar Singh 2020 年 6 月 15 日
could you please write the proper code because i am new for matlab .

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

 採用された回答

Walter Roberson
Walter Roberson 2020 年 6 月 15 日

0 投票

filename = 'File.txt';
fid = fopen(filename, 'rt');
GAL = cell2mat(textscan(fid, '%*s%f%f%f', 1, 'headerlines', 2, 'collectoutput', true));
fclose(fid);

1 件のコメント

Arun Kumar Singh
Arun Kumar Singh 2020 年 6 月 15 日
Thank you sir, it worked ...

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by