Access to a structure value with the field path in a String form
Mostrar comentarios más antiguos
Hi,
I don't know how to access to a specific array stored in a structure by using the field path stored in a String form. The following code shows my issue:
clear all;
clc;
Struct.a.b.c.d = [1 2 3; 4 5 6]; % Structure containing the Matrix
structString = 'a.b.c.d(:,1)'; % String with the desired path
Ideally, I would like to access to the matrix with something like:
value = Struct.(structString)
But it doesn't work...
Thanks in advance for your help!
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 9 de Ag. de 2015
Why are you trying to get a string involved in this at all? Why not just get the values directly from the structure:
value = Struct.a.b.c.d(:,1)
I just don't see any need to involve a string at all.
1 comentario
Rodolfo_H
el 10 de Ag. de 2015
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!