EDIT: The question above concerns strictly to the output that MATLAB produces by default in an interactive session, as illustrated by the given example. I have no interest in ways to modify the appearance of the output produced by scripts, functions, methods, etc.
Also, the motivation for this is to keep more of my laptop's extremely scarce "screen real estate" for actually informative output.
Even with format compact
, MATLAB's output includes an ans =
line in addition to the line(s) that show the output proper. E.g.
>> format compact
>> date
ans =
04-Sep-2012
>>
Is there any way to suppress the ans =
line, so that, e.g., the last interaction above looks like this?:
>> date
04-Sep-2012
>>
...or at least like this?:
>> date
ans = 04-Sep-2012
>>
This is a bit tricky and might have other consequences, but if you are mainly displaying data of a certain type (double, char, etc.) you can overwrite the corresponding built-in display method.
For example,
>> % Before overwriting the @char/display
>> date
ans =
04-Sep-2012
Now create an @char
directory in a location that is on MATLAB's path and add a method called display.m
:
function display(x)
disp(x)
end
Then you would have
>> % After overwriting the @char/display
>> date
04-Sep-2012
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With