How can I access the data stored in a 1x16 struct in a .mat file?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ken Mathai
am 12 Sep. 2018
Kommentiert: Stephen23
am 12 Sep. 2018
The name of the .mat file: NoDotsAnalyzed.mat.
I downloaded the .mat file, then opened it using: load('NoDotsAnalyzed.mat')
This created 3 structures: current_save, data_dic_save, reference_save. The sizes, respectively: 1x16, 1x1, 1x1. The data I believe is stored in data_dic_save. How can I access this data so that I can plot it?
1 Kommentar
Stephen23
am 12 Sep. 2018
@Ken Mathai: your question is self-contradictory: in your title you ask "How can I access the data stored in a 1x16 struct...", but in the description you state that "... current_save, data_dic_save, reference_save. The sizes, respectively: 1x16, 1x1, 1x1. The data I believe is stored in data_dic_save", which means that the structure you want to plot has size 1x1.
So what is the size of the structure: as your title (1x16), or as the question body (1x1) ?
Akzeptierte Antwort
Stephen23
am 12 Sep. 2018
Bearbeitet: Stephen23
am 12 Sep. 2018
S = load('NoDotsAnalyzed.mat');
plot(S.data_dic_save.WhateverFieldYouWantToPlot)
You need to know which field/s of the structure that you want to plot. You need to then use the dot syntax, like I showed, to access the data in that field. I cannot show you the exact fieldname in my example, because you did not tell us the name of the field that you want to plot.
2 Kommentare
Stephen23
am 12 Sep. 2018
I ended up being able to access the fields within data_dic_save. It turns out that was a container for multiple fields that hold all the data.
I'm proceeding to plot by just doing: plot(data_dic_save.FIELD1, data_dic_save.FIELD2) etc.
Thank you for your assistance!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!