matlabcommand-window

Prevent printing to command line in MATLAB


Before you answer, I'm not looking for the functionality of ; to suppress command line printing.

I have a set of scripts which are not mine and I do not have the ability to change. However, in my scripts I make a call to these other scripts through evalin('base', 'scriptName'). Unfortunately, these other scripts do a lot of unnecessary and ugly printing to the command window that I don't want to see. Without being able to edit these other scripts, I would like a way to suppress output to the command line for the time that these other scripts are executing.

One potential answer was to use evalc, but when I try evalc(evalin('base', 'scriptName')) MATLAB throws an error complaining that it cannot execute a script as a function. I'm hoping there's something like the ability to disable command window printing or else redirecting all output to some null file much like /dev/null in unix.


Solution

  • I think you just need to turn the argument in your evalc example into a string:

    evalc('evalin(''base'', ''scriptName'')');