How can I make a check box toggle when plot has different type?

조회 수: 2 (최근 30일)
sadel
sadel 2011년 6월 4일
Here is what I have done so far.
[W,fs]=wavread(FileName); %this reads a wave file
[~,~,~,P]=spectrogram(W(:,end),tres,tres/2,fres,fs); %tres is time resolution %and fres is frequency resolution.
I=flipud(-log(P)); %here 'I' gives the spectrogram image in a matrix.
imshow(I,[]); %this line will display the image.
now my question is if I choose a pixel co-ordinate from the image matrix I how can I get its frequency?
  댓글 수: 1
sadel
sadel 2011년 6월 4일
How can I "ask" the axes object if there is a plot already and what type is it? If there is a bode or rlocus or....

댓글을 달려면 로그인하십시오.

채택된 답변

Paulo Silva
Paulo Silva 2011년 6월 4일
ErrorFlag=1; %the code inside the while is executed
while(ErrorFlag)
try
%replace this line with your plot command
%if the plot command works without any error all worked fine so:
ErrorFlag=0; %change the flag to 0, the loop stops after this line
catch err
%if the error happens
cla %clear the axes
%axis is cleared so you can plot any type of plot
end
end
Answer edited, Jan Simon suggestion added.
The check box status remains the same.
If you want to send the error to the command line add this line after the catch:
LError=lasterror; disp(LError.message);
  댓글 수: 5
sadel
sadel 2011년 6월 4일
Thank you both!!!
Paulo Silva
Paulo Silva 2011년 6월 4일
good and simple advice Jan :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Classical Control Design에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by