Invalid handle Error in Saveas command

조회 수: 7 (최근 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 CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by