Effacer les filtres
Effacer les filtres

to receive data from simulink and send to app designer

30 vues (au cours des 30 derniers jours)
Hassan Khan
Hassan Khan le 21 Fév 2023
Modifié(e) : Luca Ferro le 27 Fév 2023
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

Réponses (1)

Luca Ferro
Luca Ferro le 21 Fév 2023
Modifié(e) : Luca Ferro le 27 Fév 2023
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 commentaires
Hassan Khan
Hassan Khan le 22 Fév 2023
can you gave me an example for this method?
Luca Ferro
Luca Ferro le 27 Fév 2023
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by