If I knew what you were trying to do at a higher level, I could give you better advice. When I read this question, I asked myself: "Why does he want to do this?" Most likely, there is a much better way to do what you are trying to do.
, , - .
function [x y] = foo
x = 0;
y = 0;
for i = 1:100
if x(end)<i
x(end+1)=i^2;
end
if y(end)^3<x(end)
y(end+1)=sqrt(x(end));
end
end
>> [x y] = foo
x =
0 1 4 25 676
y =
0 1 2 5 26
, - , , , . , , , , - , /.
, , . , ? , ? ? , ?
, , :
function [xout yout] = foo
n=100;
x = 0;
y = 0;
xout = repmat(x,n,1);
yout = repmat(y,n,1);
for i = 1:n
if x<i
x=i^2;
end
if y^3<x
y=sqrt(x);
end
xout(i)=x;
yout(i)=y;
end
xout = unique(xout);
yout = unique(yout);
>> [x y] = foo
x =
1
4
25
676
y =
1
2
5
26