필터 지우기
필터 지우기

Read/write Simulink model from within AppDesigner

조회 수: 9 (최근 30일)
Jack Daniels
Jack Daniels 2022년 11월 14일
편집: Sai Gokul 2023년 7월 12일
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?

답변 (1개)

Sai Gokul
Sai Gokul 2023년 7월 12일
편집: Sai Gokul 2023년 7월 12일
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!

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by