I am trying to write a for loop with multiple conditions, for example:
for i=1:100 && j=1:100
plot(i,j)
end
could you guys help me out please, this is my first time doing this
As ogzd mentioned, this is how you can plot all combinations of i
and j
with a nested loop.
If you are specifically interested in plotting though, you probably don't need a double loop for that. Check out:
hold on
for i = 1:100
plot(i,1:100,'o')
end
Or even more vectorized:
[a b] = meshgrid(1:100,1:100)
plot(a,b,'o')
EDIT: maybe you are just looking for this:
x = 1:100;
plot(x,x) % As y = x , otherwise of course plot(x,y)