Matlab – ny way to silence the ‘hold’ function in Matlab


I'm doing some data analysis in Matlab, and anytime I call the hold function to keep plotting to the current figure, I get an output like this:

Current plot held

I'd like to avoid this print, since it's just ugly and clutters my output. Unfortunately, placing a ; after the command does not silence it.

Is there something I can do (save from reworking my display code to avoid 'hold' commands altogether)?

Best Solution

Looks like the hold command displays "Current plot held" if you call it with the axis handle as the sole parameter, e.g.

>> hold(gca)
Current plot released
>> hold(gca)
Current plot held

However, if you tell it the hold state you want then the output is suppressed, e.g.,

>> hold(gca,'on')

You could also call hold in the following manner

>> axes(axesHandle)
>> hold on % or hold('on') if you prefer calling it as a function

If you want to avoid using the hold command/function, you could set the NextPlot property of the axis to add, e.g.

>> axesHandle=axes;
>> set(axesHandle,'NextPlot','add')
Related Question