How to save a matrix output to a text file that located in different folder?
16 ビュー (過去 30 日間)
古いコメントを表示
Abdulaziz Abutunis
2017 年 9 月 16 日
コメント済み: Abdulaziz Abutunis
2017 年 9 月 16 日
Hello All,
I want to save a matrix output (My_matrix ) to a text file (scaled_1.txt) that located in different folder than the script (.m file).
I have tried
fid = fopen('F:\output\scale\scaled_1.txt', 'w');
fprintf(fid, '%s\n', ' My_matrix ');
fclose(fid)
This will only print the text (My_matrix ) and not the content of the matrix.
I appreciate your suggestions in advance
Thanks
0 件のコメント
採用された回答
Walter Roberson
2017 年 9 月 16 日
filename = 'F:\output\scale\scaled_1.txt';
arrayname = 'My_matrix';
fid = fopen(filename, 'w');
fprintf(fid, ' %s \n', arrayname);
fclose(fid)
save(filename, arrayname, '-ascii', '-double', '-append');
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!