fprintf 2 vector output

3 次查看(过去 30 天)
Jay
Jay 2016-10-11
评论: Star Strider 2016-10-11
I am trying to print 2 vectors side by side.
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.

采纳的回答

Star Strider
Star Strider 2016-10-11
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);

更多回答(1 个)

Jay
Jay 2016-10-11
Thankyou Star Strider

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by