Looping over inputs provided by structure
Mostrar comentarios más antiguos
the Structure Setup
AppleDataGreen = struct('taste','Sour', 'color','Bright')
AppleDataRed = struct('taste','Sweet', 'color','Bright')
apples = struct( 'AppleType' ...
, struct('Green',struct(AppleDataGreen) ...
,'Red', struct(AppleDataRed)) )
I have a code that I want to run the data in the green structure and then run the Red structure
From matlab I was trying to us a for loop by doing this
% this takes me to the green and red structure giving me a
% length 2 hopefully
for i=1:length(apples.AppleType)
run(apples.AppleType{i})
code
end
error cell contents reference from a non-cell array object
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!