How can i plot a 1x3 struct?

14 ビュー (過去 30 日間)
Phil54
Phil54 2016 年 5 月 5 日
コメント済み: Phil54 2016 年 5 月 5 日
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
Azzi Abdelmalek 2016 年 5 月 5 日
Your question is not clear. When, in Command Windows you type
whos your_variable
What did you get?
Phil54
Phil54 2016 年 5 月 5 日
I get this
Name Size Bytes Class Attributes
HC_mittel_struct 1x3 436 struct

サインインしてコメントする。

回答 (1 件)

Steven Lord
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?
  1. Plot the scalar double from field x
  2. Create a text object displaying the word 'Steve' from field y
  3. Create a surface plot from the single precision array in field z
  4. Copy the line whose handle is stored in field q to a new axes
  5. Multiple or all of the above options 1-4
  6. 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.
  1 件のコメント
Phil54
Phil54 2016 年 5 月 5 日
The structure includes 3 values. I want to plot every value in the same 2-D plot (ordinate = value and abscissa quantity of values).
I hope that it is clear now.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by