MATLAB: Use a variable name with VideoWriter

videowriter

I am trying to create a program to create videos from images. I would like to use inputdlg to create a variable file name. I can use a selected path. However, it doesn't appear that VideoWriter allows you to use a variable name. Is there a way around this?

Best Answer

VideoWriter has no problems with variable file names.
[filename, pathname] = uiputfile('*.avi', 'Select an output file');
if ~ischar(filename); return; end %user cancel
fullname = fullfile(pathname, filename);
obj = VideoWriter(fullname);
...