How can I access the data stored in a 1x16 struct in a .mat file?

2 views (last 30 days)
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 Comment
Stephen23
Stephen23 on 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) ?

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 12 Sep 2018
Edited: Stephen23 on 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 Comments
Stephen23
Stephen23 on 12 Sep 2018
Ken Mathai's "Answer" moved here:
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!
Stephen23
Stephen23 on 12 Sep 2018
@Ken Mathai: Remember to accept my answer if it helped you!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!