MATLAB 2019a ginput spectrogram issue

1 回表示 (過去 30 日間)
Shae Morgan
Shae Morgan 2019 年 4 月 22 日
コメント済み: Shae Morgan 2019 年 4 月 22 日
I recently updated to 2019a from 2018a and my code no longer works. I get the error below from the following code:
y = randn(10^5,1);
fs = 10^4
spectrogram(y,600,450,[],fs,'yaxis','minthreshold',-110);
[x_info,y_info]=ginput(1);
"Unrecognized method, property, or field 'Visible' for class 'matlab.graphics.GraphicsPlaceholder'.
Error in ginput>setupFcn (line 225)
initialState.toolbarVisible{1} = tb.Visible;
Error in ginput (line 62)
initialState = setupFcn(fig);
Error in test (line 3)
[x_info,y_info]=ginput(1);"
This code is simplified; In the actual application, I'm gathering duration data from speech samples (displayed in the spectrogram to see onset/offset).
Any tips?
Thank you
Shae

採用された回答

Adam Danz
Adam Danz 2019 年 4 月 22 日
編集済み: Adam Danz 2019 年 4 月 22 日
Changes were made to the toolbar starting in R2018b. The ginput() function temporarily disables the toolbar on the figure. To do so, it must find the handle to the tool bar and set its Visible property to 'off'.
In your spectrogram plot, the toolbar handle is empty and the error is thrown because the empty handle doesn't have the 'Visible' property.
This is probably a bug; I'll report it.
I found a way to get around it, though. After creating the spectrogram plot and before calling ginput(), add a toolbar handle to the axes.
y = randn(10^6,1);
spectrogram(y,600,450,[],fs,'yaxis','minthreshold',-110);
axh = gca; %add this
axh.Toolbar = matlab.ui.controls.AxesToolbar(); %add this
[x_info,y_info]=ginput(1);
  1 件のコメント
Shae Morgan
Shae Morgan 2019 年 4 月 22 日
this is exactly what I needed - thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by