Read specific line in Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a textfile with some data, which i've made in MatLab with the fwrite-command. Only, now i've discovered i need to use those data again, and i'm not entirely sure how to import it again, and only read one specific line. I've found some commands to do this like 'fileread', but i'm not sure how to use it. My textfile i'm trying to import again, is something looking like this:
General model:
VA1(x) = a*x+b
Coefficients (with 95% confidence bounds):
a = -0.0191 (-0.04125, 0.003042)
b = 0.2261 (0.2056, 0.2466)
I'm trying to get the values for a, in again.
As a sidenote: This data is called '2_1speed.txt', but when i'm trying to import this using 'fopen', it shows an error, because of the underscore. Is there a way to still import it, with the underscore in the name of the file?
댓글 수: 0
답변 (1개)
Steven Lord
2015년 10월 5일
Rather than writing the fit object's displayed text to a text file, next time consider saving the object itself to a MAT-file. Then you could use COEFFVALUES on that object to retrieve the full precision value of that parameter, rather than the truncated version included in the displayed text.
FOPEN should be able to handle files with underscores in the name. Call FOPEN with two outputs and check the second output to see what it says is the problem with opening that file.
참고 항목
카테고리
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!