How can i plot a 1x3 struct?
조회 수: 14 (최근 30일)
이전 댓글 표시
I import data from different files into a struct. There a 3 important dates in a 1x3 struct. Now i want to plot my values in my struct. How can i manage this?
댓글 수: 2
Azzi Abdelmalek
2016년 5월 5일
Your question is not clear. When, in Command Windows you type
whos your_variable
What did you get?
답변 (1개)
Steven Lord
2016년 5월 5일
Struct arrays can hold any type of data in their fields. So you're going to need to clarify what you mean by plotting a struct. Suppose you had this struct array:
S = struct('x', 1, 'y', 'Steve', 'z', single(magic(5)), 'q', plot(1:10))
What exactly would you want plot(S) to do?
- Plot the scalar double from field x
- Create a text object displaying the word 'Steve' from field y
- Create a surface plot from the single precision array in field z
- Copy the line whose handle is stored in field q to a new axes
- Multiple or all of the above options 1-4
- Something completely different than options 1-5
Now extracting the data from one of the fields and plotting the extracted data works fine.
surf(S.z)
But you need to specifically tell MATLAB that's what you want to do.
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!