Borrar filtros
Borrar filtros

Read/write Simulink model from within AppDesigner

9 visualizaciones (últimos 30 días)
Jack Daniels
Jack Daniels el 14 de Nov. de 2022
Editada: Sai Gokul el 12 de Jul. de 2023
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?

Respuestas (1)

Sai Gokul
Sai Gokul el 12 de Jul. de 2023
Editada: Sai Gokul el 12 de Jul. de 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!

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by