Matlab prints comments and other script content in command window
Below is the script in which I am summing the elements of the vector. My problem is that whenever I run the script, Matlab prints everything in the command window. That is, it prints out comments and everything else.
I only wanted to print the sum as the result, so I didn't put ;
after y = sum(x)
.
Can anyone help me prevent Matlab from printing script comments and contents other than the ones I only want to print? Below is the script list
%simple script %this script sums the number of elements in a vector. x = 1:2:10; y = sum(x)
Here is the output in the command window
+3
source to share