Display spectrogram on axes GUI [before 2017b version]

1 次查看(过去 30 天)
Hi, I'm having compatibility problems regarding the spectrogram function when displaying it on a GUI file axes. With the code below it runs well on 2017b. But in R2017a it throws the following error:
Struct contents reference from a non-struct array object.
Error in pspectrogram>displayspectrogram (line 179)
if strcmp(hRotate.State,'off')
Error in pspectrogram (line 86)
displayspectrogram(t,f,P,isnormfreq,faxisloc,esttype,threshold);
Error in spectrogram (line 168)
pspectrogram({x},'spect',varargin{:});
Error in testResults>testResults_OpeningFcn (line 83)
axes(handles.axes5); spectrogram(Y,[], [], [], fs);
Im using the code below:
axes(handles.axes5); spectrogram(Y,[], [], [], fs);
where fs is the sampling frequency and Y signal that i want to analyze.
It's supposed to be like this [Picture using R2017b];

回答(1 个)

Giacomo Echevers
Giacomo Echevers 2018-6-20
After a long struggle trying to figure out how to solve this, I believe I've understood what's the issue here.
This particular error:
Struct contents reference from a non-struct array object.
Error in pspectrogram>displayspectrogram (line 179)
if strcmp(hRotate.State,'off')
Is trying to tell us that the structure hRotate isn't actually a structure or maybe it is empty. As a matter of fact, the latter option is what I believe is happening. The structure hRotate refers to the "Rotate 3D" Toolbar option in a regular figure, which is apparently necessary to perform a spectrogram using said function. So what I think might be the solution is to include that toolbar option in your GUI and that should solve the problem.
Cheers.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by