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!