The forum

No data written to file in Matlab when using writeVideo

Author Replies
Carson12 Monday 27 May 2019 at 13:42
Carson12Anonymous

I am attempting to create a movie file from ascii data using Matlab. I am running Matlab on Ubuntu 13.10. When I run my Matlab script (see below), the frames display correctly and the .avi video file is created at the end, but there is no data in the file mypremiercreditcard.

clc
clear all

 writerObj=VideoWriter('testVideo');
 writerObj.FrameRate = 10;
 open(writerObj);

for i=1:15000
    j=i*100;
    str=[num2str(j),'_Temp1.dat'];
    t=importdata(str);
    showaxes;
    colorbar;
    imagesc(t);
    set(gca,'ydir','normal')
    frame=getframe;
    writeVideo(writerObj,frame);
   % movieFrames(:,i) = frame;
end
close(writerObj);

And in Matlab I get the error:

Warning: No video frames were written to this file.  
The file may be invalid.  
> In VideoWriter.VideoWriter>VideoWriter.close at 307
In VideoWriter.VideoWriter>VideoWriter.delete at 256
In videomaker at 2  

Error using importdata (line 136)
Unable to open file.

Error in videomaker (line 11)
t=importdata(str);

Edited by Carson12

Dadu042 Monday 27 May 2019 at 16:34
Dadu042
Moderator

Why asking this question here ?