How to plot the complete data in a structure

조회 수: 11 (최근 30일)
Chao Zhang
Chao Zhang 2021년 11월 17일
답변: Prateek Rai 2021년 11월 21일
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
Adam Danz
Adam Danz 2021년 11월 17일
It would be easier to understand the struct if you attach it in a mat file or supply code that recreates a similar structure.

댓글을 달려면 로그인하십시오.

채택된 답변

Prateek Rai
Prateek Rai 2021년 11월 21일
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개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by