How do I write in For loop 2 condition
5 views (last 30 days)
Show older comments
I would like to create script for For Loop in 2 factors
1. "A" very 0:0.2:40
2. "B" very 0:0.2:40
How do I create that
Could you please suggest method to solve that
Thank you
0 Comments
Answers (1)
Walter Roberson
on 27 Jul 2015
for A = 0:0.2:40
for B = 0:0.2:40
...
end
end
or
for AB = [0:0.2:40;0:0.2:40]
A = AB(1); B = AB(2);
...
end
or
Avals = 0:0.2:40;
Bvals = 0:0.2:40;
for K = 1 : length(Avals)
A = Avals(K);
B = Bvals(K);
...
end
I do not recommend using the AB version: it is obscure and would confuse most readers.
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!