use a variable name with VideoWriter
조회 수: 4 (최근 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!