How to add a plot to the structure array for each element

25 views (last 30 days)
Rizwan Khan
Rizwan Khan on 26 Sep 2020
Edited: Matt J on 27 Sep 2020
Hi have a struct array
Each element has a time series.
I would like to add a plot to each element of the array
Then when i view the data type in a grid format, i want to see the plot for each of the elements within the struct array
How can i do this?
I know how to create struct array,i already have that
I can create a plots from the data, i already have that,however,each plot is not connected to each array elements, that is what i would want
So smoething like array(i).Plot should have the plot object, and then in the grid when i view the object, i should be able to see the plot for each array element
  2 Comments
Rizwan Khan
Rizwan Khan on 26 Sep 2020
I would like to make a list that has something like the link above. That is the end objective.
See how it has graphs on the right for each item, i want that for each of my struct array items
Currently i create a struct with some stock data
i then perform a number of calculations on that data, and save the results of my trading system into a struct,which included the equity curve (just an array), which is part of the struct.
I now want to be able to view the equity curve for all my 500 variations of my system.
So i want to see all 500 plot, one for each trading system. Then i can select the one i like.
Currenlty i need to do this manually
where i plot the first one, then the next one then the next. and by the time i'm upo the 10th i've forgotten what the firt looked like.
So i have the equity array as part of the struct, so i was hopeful i can somehow also add the plot
and then see it all
Any thoughts?

Sign in to comment.

Answers (1)

Matt J
Matt J on 26 Sep 2020
You can achieve what you want to use with subplot(), but I don't think it would be wise to give each time series its own axis. I think you should put several on one axis, like in this example:
  4 Comments
Matt J
Matt J on 27 Sep 2020
that doesnt' give me what i want though
What you want is neither easy to implement nor practical. The fundamental problem, as stated by you, is keeping multiple labelled plots in view at the same time for comparison purposes. How will you keep 500 separate axes in view simultaneously?
It makes much more sense to compare time series on multi-line plots, with legend entries to display their companion data. You might build such plots along the lines of the following example:
S(1).name="Fred";
S(1).ID=5;
S(1).data=1:5;
S(2).name="George";
S(2).ID=71;
S(2).data=log(1:5);
for i=1:numel(S)
S(i).legendEntry=S(i).name+" "+S(i).ID;
plot(S(i).data)
hold on
end
hold off
legend(S.legendEntry);

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by