use a variable name with VideoWriter
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Walter Roberson
2018-4-9
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);
...
0 个评论
更多回答(1 个)
Bryan Clark
2018-4-10
编辑:Walter Roberson
2018-4-10
1 个评论
Walter Roberson
2018-4-10
response = inputdlg('Input File Name');
fileName = response{1};
if isempty(fileName); return; end %user cancel
[dirname, basename, ext] = fileparts(fileName);
if isempty(ext); ext = '.avi'; end
fileName = fullfile(dirname, [basename ext]);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!