If you type the expression
into MATLAB, you will get the result
1×0 empty double row vector
So, your for loop doesn't have any iterations.
You could try
Also, note that
will sum the first 50 elements of x, without a for loop, and
will sum all the elements of x.
Seems like you might benefit from a beginners tutorial in MATLAB. You might want to take a look at the MATLAB Onramp.