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

5 次查看(过去 30 天)
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

采纳的回答

Jarrod Rivituso
Jarrod Rivituso 2011-4-26
编辑:John Kelly 2015-2-26
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 个评论
Michael Mahadas
Michael Mahadas 2011-4-27
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;
axes(handles.SpectrumPlot)
plot(spectrum)
: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
array.
Error in ==> Graphic_Equalizer>play_Callback at
4024
spectrum = fftrto.OutputPort(1).Data;
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Graphic_Equalizer at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)Graphic_Equalizer('play_Callback',hObject,eventdata,guidata(hObject))
Kaustubha Govind
Kaustubha Govind 2011-4-28
Have you also tried adding an event-listener function to PostOutputs and updating the GUI from that function?

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by