Dynamic Loop with for

1 visualización (últimos 30 días)
Dzevat
Dzevat el 9 de Ag. de 2018
Abierta de nuevo: Walter Roberson el 22 de Dic. de 2018
Dynamic Loop
  1 comentario
Stephen23
Stephen23 el 9 de Ag. de 2018
What is a "dynamic loop"? Please show us your code so we have some idea of what you are doing.

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 9 de Ag. de 2018
Editada: KSSV el 9 de Ag. de 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 comentario
KSSV
KSSV el 9 de Ag. de 2018
The code should work for any N...edited the code with present N..check.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by