how to only clear data in fig
Ältere Kommentare anzeigen
Hi
i wnat to clear only data in fig
I try to cla reset but this command all initializes another settings.
i wnat remain other setting (ex. xlim, view etc...)
Eventually , I want animate rotating circle Thanks for your review
%%
clear all;
clc;
close all;
%%
% p_circle0 = circle(1,1,1);
n_circle_p = 50;
theta_c = 0:2*pi/(n_circle_p-1):2*pi;
p_circle = zeros(n_circle_p, 3);
r = 1;
for i = 1:n_circle_p
p_circle(i,:) = [r*cos(theta_c(i)), r*sin(theta_c(i)), 0];
end
% p_circle = [p_circle0, zeros(size(p_circle0,1),1)];
N = size(p_circle,1);
N_sample = 10;
theta = 0:pi/(N_sample-1):pi;
fig1 = figure(1);
p_circle2 = zeros(size(p_circle));
for i = 1:N
p_circle2(i,:) = (rotx(theta(1))*p_circle(i,:)')';
end
line(p_circle2(:,1),p_circle2(:,2),p_circle2(:,3));
grid on;
xlim([-1.5, 1.5]);
ylim([-1.5, 1.5]);
zlim([-1.5, 1.5]);
xlabel('x');
ylabel('y');
zlabel('z');
view([30, 40]);
%%
for j = 1:N_sample
p_circle2 = zeros(size(p_circle));
for i = 1:N
p_circle2(i,:) = (rotx(theta(j))*p_circle(i,:)')';
end
line(p_circle2(:,1),p_circle2(:,2),p_circle2(:,3));
line(p_circle2(1:2,1),p_circle2(1:2,2),p_circle2(1:2,3), 'Color', 'r');
grid on;
xlim([-1.5, 1.5]);
ylim([-1.5, 1.5]);
zlim([-1.5, 1.5]);
xlabel('x');
ylabel('y');
zlabel('z');
view([30, 40]);
pause(0.5);
cla reset;
drawnow % display updates
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Graphics Object Properties finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!