How to prevent any variable from displaying its name?

7 vues (au cours des 30 derniers jours)
Luis Martinez
Luis Martinez le 2 Sep 2013
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!

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Function Creation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by