How to prevent any variable from displaying its name?

조회 수: 7 (최근 30일)
Luis Martinez
Luis Martinez 2013년 9월 2일
How do I prevent a variable from displaying its name when it is returning an answer back on the command window?
Example:
a=1+1 %input by user
a= 2 %result
But I want to see:
a=1+1 %input by user
2 %result
Thanks in advance!

채택된 답변

Jan
Jan 2013년 9월 2일
Use a semicolon on the end of each line, e.g.:
a = 1 + 1;
disp( num2str(a) );
  댓글 수: 2
Luis Martinez
Luis Martinez 2013년 9월 2일
Thanks Jan! (: Exactly what I needed!
Jos (10584)
Jos (10584) 2013년 9월 2일
no need for num2str.
disp(a)
would also do

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

추가 답변 (0개)

카테고리

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