Effacer les filtres
Effacer les filtres

Video making in MATLAB

2 vues (au cours des 30 derniers jours)
TTA
TTA le 20 Sep 2016
Commenté : TTA le 20 Sep 2016
I'm trying to make video out of the function that suppose to generate 234 plot (Ro by GammamaxB) but it keeps telling me that Frame must be 370 by 326.
How can fix it...........
vidObj = VideoWriter('peaks123.avi');
open(vidObj);
for Ro = 0.05:0.05:0.45;
for GammamaxB = 0.5:0.1:3;
skyMap_i(Ro,GammamaxB);
set(gca, 'nextplot','replacechildren');
currFrame = getframe;
writeVideo(vidObj,currFrame);
end
end
% close(gcf)
%# save as AVI file, and open it using system video player
close(vidObj);
  2 commentaires
Geoff Hayes
Geoff Hayes le 20 Sep 2016
Toyese - what keeps telling you that the frame must be 370x326? Please copy and paste the full error message into this question.
Also, what is skyMap_i?
TTA
TTA le 20 Sep 2016
Modifié(e) : Image Analyst le 20 Sep 2016
This is the function
function Phi = skyMap_i(Ro,GammamaxB)
PA = [];
irange = 20:5:90;
filename = ['Name_R',num2str(Ro),'_B',num2str(GammamaxB),'_ii', num2str(20),'.dat'];
LC = dlmread(filename, ' ');
prange = LC(:,1);
for ii = irange
filename = ['Name_R',num2str(Ro),'_B',num2str(GammamaxB),'_ii', num2str(ii),'.dat'];
LC = dlmread(filename, ' ');
PA = [PA; LC(:,2)'];
end
figure
[p_f,i_f] = meshgrid(prange,irange);
[c,c] = contourf(p_f/(2*pi),i_f,PA,60);
colorbar
title(strcat('Ro= ',num2str(Ro),',',' \beta_{Max}= ',num2str(GammamaxB)),'Fontsize',20,'Fontweight','Bold')
xlabel('Orbital phase','Fontsize',20,'Fontweight','Bold')
set(c,'linewidth',2,'linestyle','none')
ylabel('Inclination angle i (degrees)','Fontsize',20,'Fontweight','Bold')
This is the error message
??? Error using ==> VideoWriter.VideoWriter>VideoWriter.writeVideo at 327 Frame must be 370 by 326
Error in ==> Plot_ContourVideo at 8 writeVideo(vidObj,currFrame);

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 20 Sep 2016
Modifié(e) : Image Analyst le 20 Sep 2016
For some reason, I think your image has changed size during the loop. Put this in the loop right after you call getframe:
size(currFrame) % Don't use a semi colon
Tell me what you see in the command window.
See attached demo where I make a movie from a changing/moving surface in a figure.
  2 commentaires
TTA
TTA le 20 Sep 2016
This is what i'm still getting................
??? Error using ==> VideoWriter.VideoWriter>VideoWriter.writeVideo at 327 Frame must be 370 by 326
Error in ==> Plot_Contour at 24 writeVideo(vidObj,currFrame);
TTA
TTA le 20 Sep 2016
and please how can I surpress figure from displaying. but run in the background

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by