Can't saveas in a specific folder => Error using saveas(line 60) Invalid handle
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Carla Bariot
am 21 Okt. 2021
Kommentiert: Stephen23
am 22 Okt. 2021
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 !
Akzeptierte Antwort
Cris LaPierre
am 22 Okt. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!