If I define a function like this
function [x, y] = findXY(B)
[by, bx] = size(B);
x = zeros(by,bx);
y = zeros(by,bx);
for i=1:10
x(i) = i;
y(i) = i;
end
end
I get the following error
The constructor for class ‘findXY’ must return only one output value.
Why is this happening? I can’t use return values in a loop?
I didn’t find something similar while googling.
I will answer my question. The problem was a bit weird. I just restarted matlab and everything worked as expected. So if you walk into trouble and you cant find what is going wrong you should give restarting a try. It may work.