save table as space delimted text file, not tab delimited
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marty Dutch
am 3 Mai 2014
Beantwortet: Azzi Abdelmalek
am 3 Mai 2014
Dear experts,
I want to save a table as a space delimted file. In the code below I save the table as tab delimted (\t). How can I the save the imput as space delimited?
table = [1 2 12;2 1 14;3 1 15]
%output file
fid = fopen('subjectlist.txt','wt');
for ii = 1:size(table,1)
fprintf(fid,'%.0f\t',table(ii,:));
fprintf(fid,'\n');
end
fclose(fid);
Thanks in advance!
Marty
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 3 Mai 2014
Add one space or more after %.0f
fprintf(fid,'%.0f ',table(ii,:))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!