fprintf 2 vector output
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jay
am 11 Okt. 2016
Kommentiert: Star Strider
am 11 Okt. 2016
I am trying to print 2 vectors side by side.
I have tried using the syntax stated in the http://au.mathworks.com/matlabcentral/answers/178568-accurately-printing-two-vectors-with-fprintf-function post to no avail.
The relevant code is:
strVal1_5 = [resLeftX, resLeftY]
fileID1 = fopen(Test.txt','wt');
fprintf(fileID1,'%.6 %.6f\r\n',strVal1_5);
Can someone please point me into the right direction.
When I specified
strVal1_5 = [resLeftX; resLeftY]
The values no longer where written into the file.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Okt. 2016
Interesting. I’d forgotten that one.
You have a typo here:
fprintf(fileID1,'%.6 %.6f\r\n',strVal1_5);
↑ ← YOU NEED ‘f’ HERE
This should work:
fprintf(fileID1,'%.6f %.6f\r\n',strVal1_5);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu File Operations 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!