抑制输出 [英] Suppress Output
问题描述
我想抑制一组Matlab函数中变量的输出.问题在于作者忘记了;".在代码中的许多位置.出于调试目的,此输出很有用,但现在我想取消它,而不在整个代码中搜索丢失的;".是否有可能关闭这种输出?
I want to suppress the output of variables in a set of Matlab functions. The problem is that the author forget the ";" at many positions in the code. For debug purpose this output is useful but now I want to suppress it, without searching the whole code for the missing ";". Is there a possibility to turn off this kind of output?
推荐答案
您可以使用evalc禁止输出,但这需要您将表达式作为字符串传递.例如,如果您使用的是:
You can suppress the output using evalc, but this requires you to pass your expression in as a string. For instance if you were using:
[A,B,C] = notMyFunction(d,e,f);
您可以改用
[T,A,B,C] = evalc('notMyFunction(d,e,f);');
现在将缓冲到控制台的所有输出,并存储在T
中.
And any output that would have gone to the console will now be buffered and stored in T
.
这篇关于抑制输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!