How to deal with a nestled struct

2 views (last 30 days)
I have a xlm I wish to study. I used this code:
clc; clear all; close all
sampleXMLfile = 'A_AXIS_1.xml';
I need to manage data starting from line 87:
Browsing the struct i can find the data here
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?
andrea vironda
andrea vironda on 31 Jul 2020
I think discard the record is the best solution. In a second step i can think how to deal with missing parameters

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 31 Jul 2020
sampleXMLfile = 'A_AXIS_1.xml';
S = fileread(sampleXMLfile);
just_numeric_cell = regexp(S, 'time="-?([\d.]+)" f1="-?([\d.]+)" f2="-?([\d.]+)" f3="-?([\d.]+)"', 'tokens');
just_numeric_array = vertcat(just_numeric_cell{:});
Attributes = str2double(just_numeric_array);
This finds about 6700 full records, with there being roughly another 2200 partial records in the file.
The largest time gap is about 0.07 seconds.
The order of columns is time, f1, f2, f3.

More Answers (0)


Find more on Structures 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!