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
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
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
2018년 9월 12일
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 Center 및 File 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!