Effacer les filtres
Effacer les filtres

Spectrum Analyzer!! - How to access data/plots from a FFT scope real time

4 vues (au cours des 30 derniers jours)
Hello everyone,
I am working on a graphic equalizer GUI that controls blocks in Simulink such as gains and audio filter inputs. The GUI operates perfectly, but I am working on a real time spectrum analyzer. I do not know how to access scope frames or data flow in real time. Essentially, I want to make the scope's information appear in the GUI's axes window. The GUI was designed using MATLAB's GUIDE
Any suggestions are appreciated.
I have looked into the Data Acquisition tool box, but I am under the assumption it does not work with 64-bit systems. Another idea was to some how sample the scopes frames and load them into the axes window in GUIDE, however I still do not know how to access the data real time or not.
Thank you, Rowan ECE

Réponse acceptée

Jarrod Rivituso
Jarrod Rivituso le 26 Avr 2011
Modifié(e) : John Kelly le 26 Fév 2015
Simulink does allow you to access signal data from MATLAB during simulation via the use of runtime objects. Check out this doc link:
If I were you, I would either
  • Add a listener to a certain block and have the callback somehow update the GUI. This approach could be very computationally intensive if you aren't careful. You may see your system slow down if you try and have the callback directly modify the GUI axes.
  • Set up a timer and periodically poll the runtime object at a certain rate. This approach means you might "miss" some data, and depending on the polling speed you could see improved performance.
Note that I have assumed here that you are trying to access simulation data from a simulation that is being run on your host machine, and not trying to access simulation data from a simulation on some other machine / processor.
  3 commentaires
Michael Mahadas
Michael Mahadas le 27 Avr 2011
Thank you for pointing me in the right direction. I have also unchecked the signal storage reuse option but I an error still occurs when I try to implement the following code:
fftrto = get_param('equalizer/MagFFT','RuntimeObject');
spectrum = fftrto.OutputPort(1).Data;
:where the equalizer is my Simulink model
:MagFFT is the name of the FFT Magnitude Block
:SpectrumPlot is the axes window of my GUI
MATLAB outputs this error: Any help is appreciated
??? Error while evaluating uicontrol Callback
??? Attempt to reference field of non-structure
Error in ==> Graphic_Equalizer>play_Callback at
spectrum = fftrto.OutputPort(1).Data;
Error in ==> gui_mainfcn at 96
Error in ==> Graphic_Equalizer at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
Kaustubha Govind
Kaustubha Govind le 28 Avr 2011
Have you also tried adding an event-listener function to PostOutputs and updating the GUI from that function?

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by