for del=-1:0.5:1, i want to get the index of the value of del being used for that specific iteration . can anyone please tell me a way to do this
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Qasim Manzoor
am 19 Okt. 2013
Kommentiert: Qasim Manzoor
am 19 Okt. 2013
I am running a for loop "for del=-1:0.5:1" and i want to get the index of the value of del being used for the iteration lets say that its the 2nd iteration so i want to get the index of 2nd value of del
0 Kommentare
Akzeptierte Antwort
sixwwwwww
am 19 Okt. 2013
Dear Qasim, the index in the 2nd value of del will be 2. You can do like this:
count = 1;
for del = -1:0.5:1
fprintf('Iteration # = %d\n', count);
count = count + 1;
end
Or if you need something else then please state your question again clearly
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!