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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by