Can't saveas in a specific folder => Error using saveas(line 60) Invalid handle

5 次查看(过去 30 天)
Hello,
I have a problem in my code, I want to select a file (video)
Create a folder with the file name
And save some frame of my video in this file with a name which contain : the video name + 'string' + date (video_frameRep_10-21-2021_12-16)
My code :
%Selection d'un fichier
[file, path] = uigetfile({'*.avi';'*.mov';'*.mp4';'*.*'},'Choississez votre fichier :');
import_video = fullfile(path, file);
[path, file, extension] = fileparts(import_video);
video = VideoReader(import_video);
first_frame = read(video,1);
figure;
imshow(first_frame);
drawcircle;
mkdir C:/Users/admin/Documents resultat_Suppression_mouvement_et_balayage
mkdir ('C:/Users/admin/Documents/resultat_Suppression_mouvement_et_balayage', file)
Filename = sprintf('%s_test_%s.jpeg',file, datestr(now,'mm-dd-yyyy_HH-MM'))
Folder = 'C:\Users\admin\Documents\resultat_Suppression_mouvement_et_balayage\nom_fichier'
saveas(first_frame,fullfile(Folder, Filename));
Thanks for help !

采纳的回答

Cris LaPierre
Cris LaPierre 2021-10-22
saveas saves a figure to a specific file format. The first input to saveas is expected to be a figure handle. You are passing in a numeric or structure array.
You can see examples of how to use saveas here:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by