Print in Command Window without 'ans = ' in matlab?

NLed picture NLed · Mar 21, 2013 · Viewed 28.1k times · Source

When I use sprintf, the results show like this :

sprintf('number=%d %d %d',a,b,c)
sprintf('or %d',h)  

ans = 

number= 5 4 2

ans =

or 2

How can I display the results without ans = obstructing them ?

Answer

Bjoern H picture Bjoern H · Mar 21, 2013

You can use fprintf instead of sprintf. Remember to put a newline \n at the end of your strings.