简体   繁体   中英

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 产量

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

>> echo off

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM