Problem with fprintf command (matrix)
古いコメントを表示
So I have a problem with fprintf command(image attached), I'm trying to display this text and XX.XX are my variables
For a weight of XX.XX Newtons, the forces are:
Ax Ay Bx F1 F2
XX.XX XX.XX XX.XX XX.XX XX.XX
Let "ans" be 5x1 column matrix and my code is
fprintf('For a weight of %4.2f Newtons, the forces are:\nAx Ay Bx F1 F2\n%4.2g',weight,ans)
%and the answer I get is below but it's not how I'm trying to do it
For a weight of 50.00 Newtons, the forces are:
Ax Ay Bx F1 F2
-50For a weight of 50.00 Newtons, the forces are:
Ax Ay Bx F1 F2
-50For a weight of 70.71 Newtons, the forces are:
Ax Ay Bx F1 F2
-50
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!