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.
In your case:
function result = stuff()
result = 0;
for i=0:10,
j += i;
end
end
will do the trick.