Effacer les filtres
Effacer les filtres

Make AVI file from plots?

2 vues (au cours des 30 derniers jours)
Sam Zipper
Sam Zipper le 19 Oct 2012
Howdy folks- I've tried searching around on here for a few hours with little success. I'm trying to make a movie that will show the evolution of the surface over time. I've successfully graphed a colored surface of x,y,z values using pcolor - x and y are the coordinates, z is an interpolated elevation - and set up a for loop to run through my images, and put them into an avi file. The only problem is that when I open the avi file in VLC, each frame is black. I'm guessing it's something to do with defining the colormap in my avifile command, but I can't figure out how it works... any tips?
I'm using R2011a on a Mac, if that matters - I know that means that I don't have any options for compression type.
Thanks! Code is below.
-Sam
clear all; close all; clc
load WSE_0524-0703.mat
aviobj = avifile('test.avi','compression','None','fps',1,'quality',100);
x = easting; % x coordinates of wells
y = northing; % y coordinates of wells
xDim = 305100:25:305650; % define dimensions to interpolate
yDim = 4793600:25:4794200; % define dimensions to interpolate
[gridX,gridY] = meshgrid(xDim,yDim); % make a meshgrid of x and y
z = wseAll(1,:)';
F = TriScatteredInterp(x,y,z); % interpolate between wells
gridZ = F(gridX,gridY); % solve for z at each point on meshgrid
colorplot = figure;
pcolor(gridX,gridY,gridZ); % 2D meshed surface colormap
hold on
shading flat % turn off grid
colorbar; % add colorbar
caxis([295 300]); % colorbar scale
hold off
frame = getframe( colorplot );
aviobj = addframe(aviobj,frame);
for k = 2:300:902;
z = wseAll(k,:)';
F = TriScatteredInterp(x,y,z); % interpolate between wells
gridZ = F(gridX,gridY); % solve for z at each point on meshgrid
colorplot = figure;
pcolor(gridX,gridY,gridZ); % 2D meshed surface colormap
hold on
shading flat % turn off grid
colorbar; % add colorbar
caxis([295 300]); % colorbar scale
hold off
frame = getframe( colorplot );
aviobj = addframe(aviobj,frame);
end
aviobj = close(aviobj);
close all
  1 commentaire
Image Analyst
Image Analyst le 19 Oct 2012
I don't have MATLAB on our Mac. For reference, there's the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_create_a_movie_from_my_MATLAB_figures.3F

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Blue dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by