Dynamic Loop with for

1 view (last 30 days)
Dzevat
Dzevat on 9 Aug 2018
Reopened: Walter Roberson on 22 Dec 2018
Dynamic Loop
  1 Comment
Stephen23
Stephen23 on 9 Aug 2018
What is a "dynamic loop"? Please show us your code so we have some idea of what you are doing.

Sign in to comment.

Accepted Answer

KSSV
KSSV on 9 Aug 2018
Edited: KSSV on 9 Aug 2018
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 Comment
KSSV
KSSV on 9 Aug 2018
The code should work for any N...edited the code with present N..check.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!