在Matlab中使用nlfilter函数时如何禁用进度条? [英] How to disable the progress bar when using the nlfilter function in Matlab?
问题描述
每次调用 nlfilter
函数时,都会出现一个进度条窗口。我怎么能禁用那个窗口?有没有像 -q
这样的选项?
Each time I call the nlfilter
function a progress bar window appears. How could I disable that window?. Is there an option like -q
?
我正在按行处理图像并应用自定义函数,所以调用nlfilter函数时生成的窗口很烦,而且还会降低系统的性能。
I'm processing an image by rows and applying a custom function, so the window generated when calling to the nlfilter function is bothering quite a lot and also decreasing the performance of my system.
请注意,我只想暂时禁用窗口。
Note that I'm only want disable the window momentarily.
推荐答案
MATLAB中的 waitbar
肯定会降低代码的性能在某些操作系统上运行长时间运行的任务时,它会变得非常讨厌,因为它可以随机窃取键盘/鼠标的焦点。
The waitbar
within MATLAB definitely reduces the performance of your code as well as gets really obnoxious when running long-running tasks on some operating systems as it can steal the focus of your keyboard/mouse randomly.
我个人创建自己的 waitbar
函数并将其放在MATLAB路径上,以便评估它而不是内置函数。
I personally create my own waitbar
function and place it on the MATLAB path so that it is evaluated rather than the built-in.
我有一个更复杂的基于文本的进度条,但以下函数将简单地将消息打印到命令行。你甚至可以删除第一个块,内容只是 varargout = {[]};
,你将没有输出。
I have a more complicated text-based progress bar, but the following function will simply print the messages to the command line. You could even remove the first block and have the contents simply be varargout = {[]};
and you will have no output.
function varargout = waitbar(varargin)
if nargin >= 2 && ischar(varargin{2})
disp(varargin{2})
elseif nargin >= 3 && ischar(varargin{3})
disp(varargin{3})
end
varargout = {[]};
end
请务必将此保存在 waitbar.m
MATLAB路径上的某个位置。
Be sure to save this in waitbar.m
somewhere high on your MATLAB path.
注意:这会使沉默所有等待栏,所以如果你想恢复典型的等待栏行为,你需要删除/重命名这个文件。
NOTE: This will silence all waitbars so if you want to restore the typical waitbar behavior, you will want to remove/rename this file.
这篇关于在Matlab中使用nlfilter函数时如何禁用进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!