Invalid handle Error in Saveas command

13 ビュー (過去 30 日間)
Permvir Singh
Permvir Singh 2021 年 3 月 24 日
編集済み: Jan 2021 年 3 月 24 日
Hi,
I am encountering Invalid Handle Error in saveas command. I am able to display the spectrogram images in for loop, but not able to save them in a specified folder.
fig = specgram(--------------------------------);
cpath = 'c:Users\Desktop\name';
gca = fig;
saveas(gca,fullfile(cpath,filename), 'jpeg');
Thanks in advance

採用された回答

Jan
Jan 2021 年 3 月 24 日
編集済み: Jan 2021 年 3 月 24 日
Do not shadow the built-in function "gca".
The first output of specgram is y, not the figure handle. If you want to get the handle, use gcf.
specgram(--------------------------------);
cpath = 'c:Users\Desktop\name';
saveas(gcf, fullfile(cpath,filename), 'jpeg');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by