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

2 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2018-9-12
@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) ?

请先登录,再进行评论。

采纳的回答

Stephen23
Stephen23 2018-9-12
编辑:Stephen23 2018-9-12
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 个评论
Stephen23
Stephen23 2018-9-12
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by