|
From: | Nicholas Jankowski |
Subject: | Re: Problem loop for and image size |
Date: | Sat, 22 Oct 2016 19:58:11 -0400 |
On Oct 22, 2016 1:13 PM, "Julien563" <address@hidden> wrote:
>
> Oh yes! I see, so how can i change both together? In same time? Whith loop
> "while"?
If you want to change both variables at the same time, then you do not need two loops. Just ibe loop, where both variables are made to change as the loop increments. This could be done with a mathematical _expression_ or an index:
for ind = 1:3
a = ind;
b = 9 + ind;
printf ("a = %i, b = %i\n", a, b);
endfor
a = 1, b = 10
a = 2, b = 11
a = 3, b = 12
Or
a = [1,2,3];
b = [10,11,12];
for ind = 1:3
printf ("a = %i, b = %i\n", a(ind), b(ind));
endfor
a = 1, b = 10
a = 2, b = 11
a = 3, b = 12
[Prev in Thread] | Current Thread | [Next in Thread] |