slash / after text .txt
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vadim Tambovtsev
am 29 Sep. 2016
Kommentiert: Massimo Zanetti
am 29 Sep. 2016
% 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 Kommentare
Akzeptierte Antwort
Massimo Zanetti
am 29 Sep. 2016
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 Kommentare
Massimo Zanetti
am 29 Sep. 2016
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Standard File Formats finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!