I have parsed an xml node into my MATLAB project with the following information:
Name: '#text'
Attributes: []
Data: '500'
Children: []
I can easily acess the name of the node using node.getNodeName
.
Now I want to read the data out of this node, but I don't get MATLAB to do this.
I tried:
dataString=node.getData;
and
dataString=char(node.getData);
In both cases I got this error:
Argument to dynamic structure reference must evaluate to a valid field name.
What went wrong with my code?
To precise my comments, your question did not contain any dynamic field names, but your code does!
The relevant code lines are the two lines
struct1.(theChild.getNodeName)=char(nameChild.getData);
Here theChild.getNodeName
is of type java.lang.String
and not of type char
. Use this line instead:
struct1.(char(theChild.getNodeName))=char(nameChild.getData);