From a txt file read the 4 line

2 ビュー (過去 30 日間)
Touts Touts
Touts Touts 2018 年 3 月 30 日
回答済み: Walter Roberson 2018 年 3 月 30 日
Sorry for this basic question, for a txt file i need to read only the 4 line, so i skip the 3 noes above
txt file
Position 1: Level 1
Position 2: Level 1
Position 1: Level 2
Position 2: Level 2
My script
fid = fopen('My.txt','r');
C = textscan(fid, '%s', 'HeaderLines', 3)
C{:}
fclose(fid);
I need to got only
Position 2: Level 2
  3 件のコメント
Touts Touts
Touts Touts 2018 年 3 月 30 日
Please did you have any idea ?
Rik
Rik 2018 年 3 月 30 日
No, because as far as I can tell, you have exactly the output you need. So if you want help, you need to explain what you get, and how that is different from what you want to have.

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 30 日
fid = fopen('My.txt','r');
C = textscan(fid, '%s', 'HeaderLines', 3, 'WhiteSpace', '', 'Delimiter', '\n');
fclose(fid);
line4 = C{1}{1};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by