抑制输出

M.K*_*isu 20 matlab

我想在一组Matlab函数中抑制变量的输出.问题是作者忘了";" 在代码中的许多位置.出于调试目的,此输出很有用,但现在我想要抑制它,而不是搜索缺少";"的整个代码.是否有可能关闭这种输出?

che*_*kow 29

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);
Run Code Online (Sandbox Code Playgroud)

You can use instead

[T,A,B,C] = evalc('notMyFunction(d,e,f);');
Run Code Online (Sandbox Code Playgroud)

And any output that would have gone to the console will now be buffered and stored in T.