creating a structure in for loop
Mostrar comentarios más antiguos
Hello,
Is it possible to create a structure in a for loop
field={'name1','name2'}
for i=1:2
structure.(field{i})=value
end
Output:
structure.name1=value
structure.name2=value
Thanks
Jinang
2 comentarios
Ruger28
el 22 de Nov. de 2019
Please, use the code format.
What are you having issues with? This will work just fine.
jinang patel
el 22 de Nov. de 2019
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!