필터 지우기
필터 지우기

Periodically fill scatter3

조회 수: 2 (최근 30일)
Sandi Homolak
Sandi Homolak 2022년 11월 11일
답변: Karim 2022년 11월 11일
I have a matrix that changes with every iteration of code and want to make a scatter3 plot from it that fills the plot in every itteration. how do I make it do that instead of overwriting the last scatter3 plot?
So the Matrix is 20x3, so in first iteration there needs to be 20 dots, second iteration 20 more so 40 overall and so on.
Also why does my scatter show up only after I stop the code from running? How to display it during code run?

채택된 답변

Karim
Karim 2022년 11월 11일
you can use the 'hold on' command to preserve the figure and add information to it, see below for an example
% create an empty figure
figure
% enable to plot multiple data
hold on
% start a loop...
for i = 1:5
% create a new dummy matrix
MyMatrix = rand(20,3) * 10;
% plot the points
scatter3(MyMatrix(:,1),MyMatrix(:,2),MyMatrix(:,3),'filled')
end
% stop the data gathering in the figure
hold off
% create a legend
legend("Iteration"+(1:5))
view(3)
axis equal
grid on

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by