Display spectrogram on axes GUI [before 2017b version]

1 Ansicht (letzte 30 Tage)
Miguel Andrade
Miguel Andrade am 23 Mai 2018
Beantwortet: Giacomo Echevers am 20 Jun. 2018
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];

Antworten (1)

Giacomo Echevers
Giacomo Echevers am 20 Jun. 2018
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.

Kategorien

Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by