i extracted frames from the video but the frames are not showing in full in the folder I saved them.

1 次查看(过去 30 天)
  2 个评论
Gabriel Mbokoma
Gabriel Mbokoma 2023-3-7
Here is my code:
clear
close all
set(groot,'defaulttextinterpreter','latex');
set(groot, 'defaultAxesTickLabelInterpreter','latex');
set(groot, 'defaultLegendInterpreter','latex');
fn='wave_equation_2D.h5'
pause on
pos = h5read(fn,'/pos');
for i=1:999
num = int2str(i);
eval(['E',num,'=','h5read(''',fn,''',','''/step',num,'/E''',');']);
end
for i=1 : 999
num = int2str(i);
var=eval(['E',num]);
plot3(pos(:,1),pos(:,2),var,'.-');
tri = delaunay(pos(:,1),pos(:,2));
plot(pos(:,1),pos(:,2),'.');
[r,c] = size(tri);
h = trisurf(tri,pos(:,1),pos(:,2),var);
axis vis3d;
caxis manual;
caxis([-0.3 0.3]);
axis equal
xlim([-1 1]);
ylim([-1 1]);
zlim([-0.4 0.4]);
axis on;
l = light('Position',[-20 -15 29]);
lighting phong
shading faceted
xlabel('$x$');
ylabel('$y$');
zlabel('$z$')
pause(0.001);
filename = ['image ' num];
print(filename,'-dpng');
end

请先登录,再进行评论。

回答(2 个)

Image Analyst
Image Analyst 2023-3-7
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
In the meantime, see how I did it in the attached demo.

Image Analyst
Image Analyst 2023-3-7
Try using getframe. See attached demo.

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by