search string in array that contain other arrays
Mostrar comentarios más antiguos
Hi everyone. Given the vector that I am attaching, which is a set of other vectors, I would like to search among the 'Phases' and do some operations if any of these 'phases' contain the string 'G'. However I cannot implement it. An follow the code I am trying. Thanks in advance
I know that the commands "in" are not read for this reason I was looking for your help. I need the for loop and the if
Thank you
for phase in logic_list{1, 1}.phases
if 'G' in phase.state
phase.duration = 10;
traci.trafficlights.setCompleteRedYellowGreenDefinition('B1',logic_list);
logic_list = traci.trafficlights.getCompleteRedYellowGreenDefinition('B1');
print(logic_list);
end
end
3 comentarios
Geoff Hayes
el 16 de Feb. de 2022
@Marco Carapellese - the attached file is (almost) empty. When I loaded it into MATLAB, there was just an empty cell array named logic_list.
Marco Carapellese
el 16 de Feb. de 2022
Jan
el 16 de Feb. de 2022
It looks like the elements of the cell array phases are objects of the class Phase. I do not know this class.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion 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!


