Reputation: 181
I'm only showing a section of my code here because the whole thing is a few hundred lines. aviFileName is defined above as a string. X is a uint16 image. Matlab runs fine and returns no errors, but I cannot find this video file. It is not in the folder where the code is. Does anyone know what I am doing wrong?
writerObj = VideoWriter(aviFileName);
open(writerObj)
img=X;
img=im2uint8(img);
writeVideo(writerObj,img);
close(writerObj);
Upvotes: 2
Views: 70
Reputation: 26069
you probably forgot to add close(writeObj)
at the end... you see if you open(...
you sometimes need to close(...
after the code ends, otherwise a file cannot be finalized.
When I run this minimal code, I do see the avi file created in the folder of the code:
aviFileName='test'
writerObj = VideoWriter(aviFileName);
open(writerObj)
img=rand(256);
img=im2uint8(img);
writeVideo(writerObj,img);
close(writerObj);
Upvotes: 1