slash / after text .txt
4 ビュー (過去 30 日間)
古いコメントを表示
Vadim Tambovtsev
2016 年 9 月 29 日
コメント済み: Massimo Zanetti
2016 年 9 月 29 日
% open your file for writing
fid = fopen('test.txt','wt');
fprintf(fid,'super\n')
% write the matrix
myData = randi(255,10,3);
if fid > 0
fprintf(fid,'%d %d %d\n',myData');
fclose(fid);
end
This script creates a .txt file of the following format: super, then 10x3 array
The question: how to add "/" after(down) the array? Thank you!
0 件のコメント
採用された回答
Massimo Zanetti
2016 年 9 月 29 日
Just print it before closing the file.
% open your file for writing
fid = fopen('test.txt','wt');
fprintf(fid,'super\n');
% write the matrix
myData = randi(255,10,3);
if fid > 0
fprintf(fid,'%d %d %d\n',myData');
end
fprintf(fid,'/');
fclose(fid);
2 件のコメント
Massimo Zanetti
2016 年 9 月 29 日
This error does not relate to "/". You are not properly opening the txt file. Indeed, I run it and it works, look in the file attached.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Standard File Formats についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!