필터 지우기
필터 지우기

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 (최근 30일)
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

채택된 답변

sixwwwwww
sixwwwwww 2013년 10월 19일
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
  댓글 수: 1
Qasim Manzoor
Qasim Manzoor 2013년 10월 19일
oh man stupid me. it was so simple and obvious. i was going through the programmers equivalent of writer's block. thanks alot. the count thing will accomplish what i needed.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by