Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Call several handles with the same name

1 visualización (últimos 30 días)
Birch
Birch el 8 de Sept. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I need a bit of help. I have 40 handels called handles.rgb1-handles.rgb40. Is it possible to call all of them without calling them one at the time?
  1 comentario
Stephen23
Stephen23 el 8 de Sept. de 2017
Editada: Stephen23 el 8 de Sept. de 2017
Next time use a non-scalar structure rather then putting an index into the fieldnames. Then your code will be a lot simpler.

Respuestas (1)

OCDER
OCDER el 8 de Sept. de 2017
Editada: OCDER el 8 de Sept. de 2017
I think dynamic field names are what you want to use.
for j = 1:40
ThisHandle = handles.(['rgb' num2str(j)]); %Use dynamic field names
%Do something with ThisHandle
end

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by