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];
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190787/image.png)
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!