Effacer les filtres
Effacer les filtres

"Invalid Handle" error message occurs

4 vues (au cours des 30 derniers jours)
Don
Don le 31 Oct 2017
Commenté : Don le 31 Oct 2017
I have the following very simple code:
fprintf(' Select Folder to store output plots and files \n');
FigPath = uigetdir('C:\Projects', ' Select Folder to store output plots ');
%FigPath = cat(2,FigPath,'\');
name = cat(2,name,'.png');
saveas(FigPath,name); % save plot to subj directory
Other Matlab programs have the very same code and work fine. Note that the %-statement adds a backslash, which doesn't help either.
Please: what's going on?

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 31 Oct 2017
Pay attention to the syntax of saveas(). The first argument should be the handle of the figure, not the path of your saved file.
Also, fullfile() might be better than cat() in your case.
  1 commentaire
Don
Don le 31 Oct 2017
That seemed to fix it. Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by