I have written a simple script in Octave. When I run it from the command line, Octave prints a line every time a variable gets assigned a new value. How do I suppress that?
MWE:
function result = stuff() result = 0 for i=0:10, j += i end end
when I run it:
octave:17> stuff() result = 0 result = 0 result = 1 result = 3 result = 6 result = 10 result = 15 result = 21 result = 28 result = 36 result = 45 result = 55 ans = 55 octave:18>
I want to get rid of the result = ...
lines. I am new to Octave, so please forgive me asking such a basic question.
by adding a semicolon at the end of your statement it will suppress the intermediate result. will do the trick. Save this answer.
In this article, we are going to discuss how to suppress the output of a command in R programming language. Suppressing means making the output invisible. We can make the output should not appear. By using invisible() function we can suppress the output.
by adding a semicolon at the end of your statement it will suppress the intermediate result.
In your case:
function result = stuff() result = 0; for i=0:10, j += i; end end
will do the trick.
Like in matlab just add a ; (semicolon) to the end of a line you don't want output to the terminal.
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