fprfintf for matrices and rounding

7 ビュー (過去 30 日間)
Joseph DeMaria
Joseph DeMaria 2020 年 11 月 4 日
回答済み: Stephen23 2020 年 11 月 4 日
Within the question we have a function that solves for such matrices A,B,and C, these matrices are each 3x3 matrices. i.e.
A=
1 2 3
4 5 6
7 8 9
B =
1 2 3
4 5 6
7 8 9
C =
1 2 3
4 5 6
7 8 9
how can I print these using fprint f to display matrix A,B, and C using two decimals within 5 spaces for each element?

採用された回答

Stephen23
Stephen23 2020 年 11 月 4 日
A = [1,2,3;4,5,6;7,8,9];
fprintf('%5.2f %5.2f %5.2f\n',A.')
1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by