How to plot spectrogram on Matlab App Designer with UIAxes?
Mostrar comentarios más antiguos
Hello, I'm trying to use spectrogram function to plot spectrogram with Matlab App Designer, not the old GUI. This means I got uifigures and uiaxes, not figure and axes in the old GUI system. There are some answers about using spectrogram function in the old GUI system, which are using axes() function to set current axes, unfortunately, I haven't seen something about using spectrogram function in App Designer, can anyone help, plz?
1 comentario
a bc
el 26 de Nov. de 2017
Respuesta aceptada
Más respuestas (1)
Please see below for an update using AppDesigner - Using 2021a
Requires signal processing toolbox - but spectrogram outputs should be similar to pspectrum outputs
% dimensions of app.dat2plot = [1 2886144]
% Sampling frequency is 4kHz
[S,F,T] = pspectrum(transpose(app.dat2plot),4000,'spectrogram', 'FrequencyLimits',[0 50],'MinThreshold',-110);
imagesc(app.UIAxes2, T, flipud(F), rot90(log(abs(S')))); %plot the log spectrum
set(app.UIAxes2,'YDir', 'normal'); % flip the Y Axis
Outputs image below in AppDesigner
1 comentario
Andrew Cline
el 1 de Dic. de 2022
Thanks for this answer. Never would have figured this out myself.
Also, you can do this afterwards to fit it to the window
axis(app.UIAxes2,'tight')
Categorías
Más información sobre 大型图像文件 en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!