How to deal with a nestled struct
Show older comments
Hi,
I have a xlm I wish to study. I used this code:
clc; clear all; close all
sampleXMLfile = 'A_AXIS_1.xml';
xDoc=parseXML(sampleXMLfile);
I need to manage data starting from line 87:

Browsing the struct i can find the data here
xDoc(2).Children(10).Children(2).Children(12).Attributes
Here i can find rec time, f1, f2 and f3 as Attributes.
How can i transfer them in a matrix so i can manipulate them?
6 Comments
Walter Roberson
on 30 Jul 2020
Could you post a sample file for us to test with?
andrea vironda
on 30 Jul 2020
Walter Roberson
on 30 Jul 2020
There are thousands of broken records in the file. For example,
<rec time="5.842000" f1="-0.229889" f2="0.000671" f3="359.989757"/>
<rec time="5.844000" f1="-0.232361" f3="359.989765"/>
<rec time="5.846000" f2="-0.001341" f3="359.989749"/>
<rec time="5.848000" f2="0.000447" f3="359.989754"/>
<rec time="5.850000" f2="0.000000"/>
Notice the second line is missing f2, the third and fourth are missing f1, the fifth is missing f1 and f3.
What would you like to have happen in those cases? There are even some records that are missing time information.
andrea vironda
on 31 Jul 2020
Edited: andrea vironda
on 31 Jul 2020
Walter Roberson
on 31 Jul 2020
In the subset I show, there are three records in a row with no f1, so taking mean of two adjacent records would not be able to fill the gap.
There are places that have over 75 missing f1 in a row.
When a defective record is encountered, can the entire record be discarded, and everything calculated based on only the full records? Or should as much be recovered as possible (a slower more complicated process)?
andrea vironda
on 31 Jul 2020
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!