How to add a plot to the structure array for each element
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Matt J
el 26 de Sept. de 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?
Respuestas (1)
Matt J
el 26 de Sept. de 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 comentarios
Matt J
el 27 de Sept. de 2020
Editada: Matt J
el 27 de Sept. de 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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/367045/image.png)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!