Dynamic Loop with for

조회 수: 1 (최근 30일)
Dzevat
Dzevat 2018년 8월 9일
다시 열림: Walter Roberson 2018년 12월 22일
Dynamic Loop
  댓글 수: 1
Stephen23
Stephen23 2018년 8월 9일
What is a "dynamic loop"? Please show us your code so we have some idea of what you are doing.

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

채택된 답변

KSSV
KSSV 2018년 8월 9일
편집: KSSV 2018년 8월 9일
N = [6 44 ; 170 179 ; 198 203] ;
iwant = cell(size(N,1),1) ;
for i = 1:size(N,1)
for j = N(i,1):N(i,2)
iwant{i} = [iwant{i} j] ; % just demo to show the variables after loop
end
end
iwant{1}
iwant{2}
iwant{3}
  댓글 수: 1
KSSV
KSSV 2018년 8월 9일
The code should work for any N...edited the code with present N..check.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by