有没有办法让Matlab中的'hold'功能静音

时间:2022-03-17 19:55:33

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:

我正在Matlab中进行一些数据分析,每当我调用hold函数来保持绘制到当前数字时,我得到一个这样的输出:

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)?

有什么我可以做的(除了重新设计我的显示代码以避免'完全'保持'命令)?

1 个解决方案

#1


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

看起来hold命令显示“Current plot held”,如果你用轴手柄作为唯一参数调用它,例如

>> 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.

如果要避免使用hold命令/功能,可以设置要添加的轴的NextPlot属性,例如:

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

#1


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

看起来hold命令显示“Current plot held”,如果你用轴手柄作为唯一参数调用它,例如

>> 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.

如果要避免使用hold命令/功能,可以设置要添加的轴的NextPlot属性,例如:

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