fprintf 2 vector output

3 vues (au cours des 30 derniers jours)
Jay
Jay le 11 Oct 2016
Commenté : Star Strider le 11 Oct 2016
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.

Réponse acceptée

Star Strider
Star Strider le 11 Oct 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);

Plus de réponses (1)

Jay
Jay le 11 Oct 2016
Thankyou Star Strider
  1 commentaire
Star Strider
Star Strider le 11 Oct 2016
My pleasure.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by