Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress Output

Tags:

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?

like image 897
M.K. aka Grisu Avatar asked Mar 01 '12 14:03

M.K. aka Grisu


People also ask

What is suppress output?

The semicolon suppresses the output of the the replied value of a command or an assignment. If you call a function, which writes to the command window, appending the semicolon does not suppress this.

How do you suppress command output?

Silencing Output To silence the output of a command, we redirect either stdout or stderr — or both — to /dev/null. To select which stream to redirect, we need to provide the FD number to the redirection operator.

How do I suppress output in R?

By using invisible() function we can suppress the output.

How do I hide Makefile output?

If you want to inhibit the display of commands during a particular make run, you can use the -s option. If you want to inhibit the display of all command lines in every run, add the special target . SILENT to your makefile .


1 Answers

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); 

You can use instead

[T,A,B,C] = evalc('notMyFunction(d,e,f);'); 

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

like image 56
cheshirekow Avatar answered Sep 23 '22 01:09

cheshirekow