Is there a way to create something like a for loop in MATLAB with a nonlinear interval i.e. log scale? I know that I can just use a while loop, but I was wondering if there was something simple like a for loop.
Is this what you're looking for:
for ctr = logspace(1,10,100)
disp(ctr)
end
The for
loop variable can range over any array. You could do:
x = [1 2 4 4 3 10];
for ctr = x
disp(ctr)
end
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With