Reading character data from .txt file to print statement
1 回表示 (過去 30 日間)
古いコメントを表示
I have this data in a text file:
0 TIROS 6
1 397U 62047A 20244.94764729 -.00000082 00000-0 14494-4 0 9995
2 397 58.3053 89.8562 0014872 107.0981 253.1694 14.88472429118167
0 VANGUARD 2
1 11U 59001A 20245.13463223 -.00000044 00000-0 -34477-4 0 9993
2 11 32.8740 131.2419 1468349 318.6787 31.1316 11.85682505625700
0 POLAR BEAR
1 17070U 86088A 20245.12580324 .00000060 00000-0 51032-4 0 9994
2 17070 89.5272 268.9063 0039092 172.4409 247.9550 13.74805603695047
I want to make an fprintf statement that calls the titles "TIROS 6", "VANGUARD 2", and "POLAR BEAR" from the text file and reads them into the print statement.
0 件のコメント
採用された回答
Walter Roberson
2020 年 9 月 22 日
S = fileread('YourFile.txt');
titlelines = regexp(S, '^0\s+(.*)$', 'match', 'dotexceptnewline', 'lineanchors');
fprintf('%s\n', titlelines{:});
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Import and Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!