JordenSH
JordenSH

Reputation: 125

Matlab is printing comments and other contents of a script to command window

Below is a script in which I sum elements of a vector. My problem here is that whenever I run the script, Matlab prints everything onto the command window. That is, it prints the comments, and everything else.

I only wanted to print the sum as an output, that is why I did not put ; after y = sum(x).

Can somebody help me prevent Matlab from printing the comments and contents of the script, except the ones I only want to print? Below is the script

%simple script
%this script sums the number of elements in a vector.
x = 1:2:10;
y  = sum(x)

Here is the output in command window output

Upvotes: 3

Views: 258

Answers (1)

Apparently echo on has been set in your MATLAB. You need to turn it off:

>> echo off

Upvotes: 7

Related Questions