Storing results from for-loop

Just wondering how I should go about storing all of the values that I get out of this loop in 'idx' without overriding the previous itteration.
idx = []
for i = length (grfcutl)
a = grfcutl{i}
b = find(a<=0)
idx = b(1)
end
Thanks!

 Respuesta aceptada

Serhii Tetora
Serhii Tetora el 3 de Sept. de 2020

0 votos

idx = [];
for i = 1:length(grfcutl)
a = grfcutl{i};
idx(end+1) = find(a<=0,1,'first')
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Sept. de 2020

Respondida:

el 3 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by