to receive data from simulink and send to app designer

조회 수: 24 (최근 30일)
Hassan Khan
Hassan Khan 2023년 2월 21일
편집: Luca Ferro 2023년 2월 27일
i am working on app designer. i have built an application through app designer . Now i want to receive data from simulink model in real time to update my app designer editfield. i dont know how to do this . please if somebody can help me in this issue. THANKS

답변 (1개)

Luca Ferro
Luca Ferro 2023년 2월 21일
편집: Luca Ferro 2023년 2월 27일
one option would be to have some to workspace blocks in the simulink file: Log data to workspace from Simulink model - Simulink - MathWorks Switzerland. You just connect them to the signal you want to log and upon simulation it will put the in the workspace in the format you choose (array, timeseries, struct,...).
Now you can store them in a variable and so update the app.
In pseudocode:
%let's say you placed a 'to workspace' block that gives you a struct 'out' with 3 signals 'a,b,c'
out=sim(<slxFileName>); %simulates and logs the signals in a variable
updateApp = plot (out.tout,out.a); %tout is the time of the simulation and will be logged in the struct automatically
The plot is just a simple example, you should use the now logged values in app functions as you prefer.
  댓글 수: 2
Hassan Khan
Hassan Khan 2023년 2월 22일
can you gave me an example for this method?
Luca Ferro
Luca Ferro 2023년 2월 27일
this is the simulink side:
let's say you want the this saturated ramp to log it on your app for some reason.
the 'to workspace' block on the bottom right corner will output the ramp array (and the simulation time) to a struct in the matlab workspace upon simulation (see code in the previous answer). From there, since they are stored in an accessible variable, you can use their values to update you app.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by