How to save a gif or video from matlab code?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
So i have a specific code that generates a moving plot, however, i want to save that as a video so i can easily access it instead of having to run the code every time. The code is very easy, it's as follows:
%%%%%%%%%%%%%%%%%%
for i=1:50
t(i)=0.1*i;
P=[0 0 20]';
s=[ 0 0 1];
R1 = [cos(i*0.0174532) 0 sin(i*0.0174532)];
R2 = [0 1 0];
R3 = [-sin(i*0.0174532) 0 cos(i*0.0174532)];
Rx = [1 0 0; 0 cos(i*0.0174532) -sin(i*0.0174532); 0 sin(i*0.0174532) cos(i*0.0174532)];
R = [R1; R2; R3];
B1 = [ 15 15 0 ]'; %sph
B2= [-15 15 0]'; %rev
B3 = [-15 -15 0]'; %rev
B4 = [15 -15 0]'; %sph
A1 = [5,14,0]'; %sph
A2 = [-30,30,0]'; %rev
A3 = [-30,-30,0]'; %rev
A4 = [5,-14,0]'; %sph
b1 = P +(R*B1); %sph
b2 = P +(R*B2); %rev
b3 = P +(R*B3); %rev
b4 = P +(R*B4); %sph
% A random rotation
b11 = [b1';
b2';
b3';
b4'];
% Base
A11 = [5 14 0 ;
-30 30 0 ;
-30 -30 0 ;
5 -14 0] ;
verts = [A11 ; b11] ;
faces = [1 2 3 4; 2 6 7 3; 4 3 7 8; 1 5 8 4; 1 2 6 5; 5 6 7 8];
patch('Vertices', verts, 'Faces', faces, 'FaceColor', 'w');
pause(0.003)
axis([-35 35 -40 50 -5 60])
end
%%%%%%%%%%%%%%%%%%%%%%%
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Robotics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!