How correctly use fprintf
Ältere Kommentare anzeigen
Hi,
could someone explain me how to correctly use fprint?
I made this test
testA =[1;2;3];
testB =[4;5;6];
fid = fopen('test_t.txt','w');
for i = 1 :3
fprintf(fid,'%d %d \n',testA(i),testB(i));
end
fclose(fid);
I was hoping to find this result in the .txt file
1 4
2 5
3 6
In the .txt file I see this " 1 4 2 5 3 6". But is funny because now that I tried to copy and paste the content of the text file in this question, I got this
1 4
2 5
3 6
Can someone explain me:
- what does it mean " %d" in fprintf and where I find the documentation about it?
- Why I see something in the .txt file that does not look like what I want, except when I do copy and paste....
Thanks
1 Kommentar
Maria
am 12 Aug. 2015
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!