How to plot the complete data in a structure
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chao Zhang
el 17 de Nov. de 2021
Respondida: Prateek Rai
el 21 de Nov. de 2021
Hi all,
The following picture is the screenshot of a structure. I want to plot all X Y X coord of this structure, but my code can only plot the X Y Z coord in the 9th row of the structure
And my code is presented here:
for m = 1 : 9
scatter3(BM(m).X_coord(:),BM(m).Y_coord(:),BM(m).Z_coord(:),40,'filled');
end
Is there a solution to plot all the xyz coordinates of these 9 rows in one figure?
Many thanks in advance for help!
1 comentario
Adam Danz
el 17 de Nov. de 2021
It would be easier to understand the struct if you attach it in a mat file or supply code that recreates a similar structure.
Respuesta aceptada
Prateek Rai
el 21 de Nov. de 2021
Hi,
You can try "hold on" to retain current plot when adding new plot.
The code will look like:
figure
for m = 1 : 9
hold on;
scatter3(BM(m).X_coord(:),BM(m).Y_coord(:),BM(m).Z_coord(:),40,'filled');
end
You can refer to hold MathWorks documentation page to find more on retaining current plot when adding new plot.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures 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!