필터 지우기
필터 지우기

Make AVI file from plots?

조회 수: 2 (최근 30일)
Sam Zipper
Sam Zipper 2012년 10월 19일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by