Matlab Output Format!

조회 수: 9 (최근 30일)
dmfwlansejr
dmfwlansejr 2021년 3월 16일
댓글: Stephen23 2021년 3월 16일
>> a=1
a =
1
>>
How to convert following format?
>> a=1
a=1
>>
  댓글 수: 1
DGM
DGM 2021년 3월 16일
I don't know that you can get such a format. You can remove the empty lines by specifying
format compact
but trying to get it all on the same line is something else.

댓글을 달려면 로그인하십시오.

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2021년 3월 16일
You cannot format the output, but you can use disp to print in that way:
a=1;
disp('a=1')
disp(sprintf('a=%d',a))
You can use either of the last two commands.
  댓글 수: 1
Stephen23
Stephen23 2021년 3월 16일
Or calling fprintf directly:
a = 1;
fprintf('a=%d\n',a)
a=1

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by