How do I declare a for loop with a given number of elements?
Ältere Kommentare anzeigen
I have a for loop:
for j=0:0.03
..
end
I want j to run through 100 elements, in ascending order, between 0 and 0.03 (the value 0.03 is hypothetical). Can somebody help me, please?
Akzeptierte Antwort
Weitere Antworten (1)
DGM
am 15 Mai 2021
consider using linspace()
for j = linspace(0,0.03,100)
% do things
end
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!