Reputation: 47
Very simple tutorial-script, that doesn't run on my MATLAB:
function y=test1(A)
[m,n]=size(A);
y = 0;
for i=1:m
for j:n
y=y+A(i,j);
end
end
Saved in test1.m. When I call it with
A = [ 1 2; 3 4];
s = test1(A)
It gives me:
Error: File: test1.m Line: 5 Column: 10 Unexpected MATLAB operator.
reffering to the n, which MATLAB also in line 5 points out as:
Parse Error at ':': might be invalid MATLAB syntax. In line two it also gives notice, that n might be unused..
How do I make sense of this, syntax looks correct to me?!
Upvotes: 1
Views: 2906