read only the numerical value of a file
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have a file which is attached. I just want to read the number in it and store it in a variable. Thanks for your help.
0 件のコメント
採用された回答
Star Strider
2018 年 1 月 15 日
This works:
filename = 'out_log_test-weak.txt';
fidi = fopen(filename,'rt');
D = textscan(fidi, '%*s%f%%', 'HeaderLines',1);
number = [D{:}]
number =
90.0800
11 件のコメント
Star Strider
2018 年 1 月 15 日
Thanks! This information could help if others have the same problem.
Restarting MATLAB might not have been necessary, though. Running:
fclose('all');
from your Command Window could have worked.
その他の回答 (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!