How to convert nested structure to contain its original data?

3 次查看(过去 30 天)
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.
data signal
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 个评论
Jan
Jan 2021-4-15
"in another set of array/table" - please do not let the reader decide, if you want a table or array. This is your decision.
Aisya Amelia
Aisya Amelia 2021-4-15
编辑:Aisya Amelia 2021-4-15
Hello @Stephan ! I did try after you suggested it, but it ended up loading all .mat files as separate variables in the workspace: when i opened mydata, it was just empty, [ ] . If I do not assign the result of load to a variable, how do I load them as one output? thank you!

请先登录,再进行评论。

采纳的回答

Jan
Jan 2021-4-15
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 个评论
Aisya Amelia
Aisya Amelia 2021-4-15
编辑:Aisya Amelia 2021-4-15
Each .mat file is a signal of m x 1 cell array. The variable of each signal are of numeric values (conductance). I want to import these arrays of values.
Jan
Jan 2021-4-15
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.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by