Getting structure content using strings
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
samuel okeleye
el 10 de Ag. de 2018
Comentada: samuel okeleye
el 11 de Ag. de 2018
I have kt containing data type "strings", one of them is "grad"i.e kt(1,1)=grad which is a string. I am also trying to get the content of the structure(Data.edata.grad) in my data using the string data set by doing Data.edata.kt(1,1) but i am getting the error kt(1,1) is not an existing field. How can i convert a string to a structure or how can i use my string data set to get the structures?
Respuesta aceptada
Walter Roberson
el 11 de Ag. de 2018
Data.edata.(kt(1,1))
You might perhaps need to use
Data.edata.(kt{1,1})
5 comentarios
Walter Roberson
el 11 de Ag. de 2018
That code relies upon the fields all being the same datatype and all scalars (either numeric scalars or scalar logical or scalar character or scalar cell array.)
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!