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

9 visualizzazioni (ultimi 30 giorni)
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 Commenti
Matt J
Matt J il 26 Set 2020
Just to be clear, a "plot" is a graphical entity. It is not a vector of data. Are you actual hoping to see a plotted graph in the variable editor window?
Rizwan Khan
Rizwan Khan il 26 Set 2020
Modificato: Rizwan Khan il 26 Set 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?

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 26 Set 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 Commenti
Rizwan Khan
Rizwan Khan il 27 Set 2020
that doesnt' give me what i want though
even if i make say 2 subplot
how do i get the data from the table to align with each plot?
Matt J
Matt J il 27 Set 2020
Modificato: Matt J il 27 Set 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);

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by