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

5 ビュー (過去 30 日間)
Carla Bariot
Carla Bariot 2021 年 10 月 21 日
コメント済み: Stephen23 2021 年 10 月 22 日
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 Center および File ExchangePrinting and Saving についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by