fprintf for multiple variables

29 ビュー (過去 30 日間)
Donghun
Donghun 2022 年 11 月 22 日
コメント済み: Donghun 2022 年 11 月 22 日
a = 3;
b = [2 3; 1 5];
fprintf('The number: %d\n The points: %6.1f %12.1f\n', a, b);
Hi, I would like to ask how I can print multiple variables using fprintf.
What I want to show is
The number: 3
The points: (2, 3), (1,5)
Thank you for your time!

採用された回答

Stephen23
Stephen23 2022 年 11 月 22 日
a = 3;
b = [2,3;1,5];
fprintf('The number: %d\nThe points: (%d,%d) (%d,%d)\n', a, b.');
The number: 3 The points: (2,3) (1,5)
  1 件のコメント
Donghun
Donghun 2022 年 11 月 22 日
Thank you very much!!
It perfectly works.
I appreciate it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by