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

5 visualizaciones (últimos 30 días)
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 !

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 22 de Oct. de 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:

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by