I'm looking to suppress the output of one command (in this case, the apply
function).
Is it possible to do this without using sink()
? I've found the described solution below, but would like to do this in one line if possible.
How to suppress output
Hear me out here, I know that to suppress output you put a semicolon at the end of a line. However even after adding the semicolon at the end of each line of my .
Accepted Answer The possibility to suppress the screen output of a script via switch is not available in MATLAB. To work around this issue, you could do the following: 1) To disable the display of any figure windows you can use the MATLAB startup option "-noFigureWindows".
It isn't clear why you want to do this without sink
, but you can wrap any commands in the invisible()
function and it will suppress the output. For instance:
1:10 # prints output invisible(1:10) # hides it
Otherwise, you can always combine things into one line with a semicolon and parentheses:
{ sink("/dev/null"); ....; sink(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With