Read/write Simulink model from within AppDesigner

12 visualizzazioni (ultimi 30 giorni)
I have a simple Simulink model (application) and I want to use the MATALB App Designer to control simulation, access runtime data and display them in runtime.
How do I acceess running Simulink model in runtime data , in my case: ouput data of the "Reshape" block, signal named as "original MATRIX [3,3]" and output data of "Resize" block named as "resized MATRIX [9,9]" from within App Designer?

Risposte (1)

Sai Gokul
Sai Gokul il 12 Lug 2023
Modificato: Sai Gokul il 12 Lug 2023
Hi Jack,
I understand you want to display the runtime data of a SIMULINK model in a MATLAB App
Here is an approach you can follow
1. Configuring the Output data of a SIMULINK model :
  • Open your Simulink model.
  • In the Simulink Editor, click on the "Simulation" tab.
  • Under the "Model Configuration Parameters" section, click on "Data Import/Export."
  • Configure the data you want to access.
2. Load and run the SIMULINK model in MATLAB App :
  • In MATLAB App create a button to start/stop the model
  • Write a Callback function for the created button with the following code
model = 'myModel';
load_system(model);
simOut = sim(model);
3.Access runtime data :
  • To access the runtime data from the Simulink model, you can use the simOut variable. It contains the simulation output, including signals, states, and other data. You can access specific data using the appropriate syntax. For example, in your case to access the signal named 'mySignal', you can use simOut.mySignal.
You can also refer to the following documentation :
Hope this hepls!

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by