Why do I receive the error "Failed to open file" when using the MOVIE2AVI function in MATLAB 6.5 (R13)?

1 view (last 30 days)
When I execute the following code:
moviefilename='moviename';
fh=figure(1);
for k=1:10
plot(1:k);
M(:,k)=getframe(fh);
end
movie2avi(M,moviefilename,...
'compression','none','fps',4);
I receive the following error:
??? Failed to open file.
Error in ==> D:\Applications\MATLAB6p5p1\toolbox\matlab\iofun\@avifile\private\avi.dll
Error in ==> D:\Applications\MATLAB6p5p1\toolbox\matlab\iofun\@avifile\avifile.m
On line 162 ==> aviobj.FileHandle = avi('open',filename);
Error in ==> D:\Applications\MATLAB6p5p1\toolbox\matlab\iofun\movie2avi.m
On line 66 ==> avimov = avifile(filename,varargin{:});
Error in ==> T:\1472259\mycode.m
On line 7 ==> movie2avi(M,moviefilename,'compression','none','fps',4);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
If you are running a code that will overwrite an existing AVI file, then you may receive an error if the existing file is open in another application. You should close any other applications that may have the file open, and then execute your code.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!