How to stop the simulation instantly and copy the data to the workspace ?
Show older comments
Hello,
I am capturing GSM signals over USRP via MATLAB simulink and I got the necessary toolboxes and auxiliary packages for this. I don't have a problem with signal capture. But there's something I can't do. If my signal strength is over 70 dBm, I want my simulation to stop. And I want the image I get at that moment to remain on the spectrum analyzer. And I want to copy the data of the current image to the workspace. But I don't know how to do this.
Thank you.
Answers (1)
Ayush Modi
on 21 May 2024
Edited: Ayush Modi
on 21 May 2024
0 votes
Hi Nazli,
You can use the "Stop Simulation" block in combination with "Relational Operator" block to stop the simulation when signal strength is over 70 dBm.
Refer to the following MathWorks documentation for more information on:
- "Stop Simulation" block: https://www.mathworks.com/help/simulink/slref/stopsimulation.html
- Example using "Stop Simulation" block with "Relational operator" block: https://www.mathworks.com/help/simulink/slref/stopsimulation.html#:~:text=Stop%20Simulation%20Block%20with%20Relational%20Operator%20Block
To capture the content of the Spectrum Analyzer visually (as an image) requires the below two steps:
- Use the "To Workspace" block to export the signal data continuously to the MATLAB workspace.
- After the simulation stops, use MATLAB's plotting functions (e.g., plot, spectrogram) to recreate the spectrum analyzer's visualization.
Refer to the below MathWorks documentation for more information on "To Workspace" block:
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!