How to convert nested structure to contain its original data?
2 views (last 30 days)
Show older comments
I'm new, and I need some help. So I have these multiple signals in double, .mat format and I managed to load them all as output using this simple code. And I want to further analyze this dataset.
But the output sets the values as struct, which doesn't allow me to conduct batch processing such as feature extraction on it, or import it in the Diagnostic Toolbox.
I want the data in the cell array to be as double, not struct. May I know how to solve this? Or it is bc there's something with my data?
9 Comments
Jan
on 15 Apr 2021
"in another set of array/table" - please do not let the reader decide, if you want a table or array. This is your decision.
Accepted Answer
Jan
on 15 Apr 2021
myFolder1 = ('C:\Users\User\Documents\Signals');
mysignals = dir(fullfile(myFolder1, '**', '*.mat'));
N = numel(mysignals);
mydata = cell(N,1);
for k = 1:N
File = fullfile(mysignals(k).folder, mysignals(k).name);
Data = load(File);
mydata{k} = Data.P2V1; % Or P2V3 or what ever?
end
4 Comments
Jan
on 15 Apr 2021
All we need to knwo for the solution is the name of the variable stored in the MAT file. Replace my "P2V1" by the name of this field. I've written "or what ever" in the hope, that you can adjust it accordingly.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!