Saving data on .m file
이전 댓글 표시
The homework question orders me to save my datas on .m file, without replacing the previous saved datas. i saved it as per the question and i see some kind of parse error
Can i get rid of it?


댓글 수: 2
Image Analyst
2021년 12월 15일
What parse error? You forgot to include it. Show us all the red text.
Maybe try 'at' for a text file instead of 'a' in fopen().
Anup Khadka
2021년 12월 15일
답변 (1개)
Walter Roberson
2021년 12월 15일
That is not necessarily an error. The data could be retrieved from the file by using load() or readmatrix()
You would not typically save data to a .m file as .m files are normally for executable code.
If the expectation is that you are to create executable code, then you need to save the data in the form of an assignment statement. Something like
fid = fopen(etc etc);
fprintf(fid, 'ag = [\n');
now fprintf a and g
fprintf(fid, '];\n');
You would then do something similar for a1 g1, except giving it a different variable name, such as 'a1g1 = '
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
