How can I show Matlab Simulink Data in Matlab App Designer?
34 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Maik Korinek
el 8 de En. de 2021
Comentada: Maik Korinek
el 19 de En. de 2021
Hey guys,
i have an active, functional Matlab Simulink model and want to show/output some datas in Matlab App Designer like a GUI Interface.
How can i do that?
I have found the block "to workspace" but thats not very helpfull, i cant connect it to the App Designer.
If you can, answer detailed.
Thanks for help! :-)
1 comentario
Mario Malic
el 8 de En. de 2021
Everything is possible!
There are many ways to do it, one of suggestions is to create a structure with the data you want to show in App Designer. Let's say you run a simulation and you get results in a variable, or a file. You can call your app and load the file or use the variable from workspace.
Respuesta aceptada
Jemima Pulipati
el 11 de En. de 2021
Hello,
From my understanding, you want to display some outputs of the Simulink model in the App Designer interface.
The most common method of starting a Simulink simulation from MATLAB and then displaying the results is to use the 'sim' function. This function is a blocking function that starts the simulation and then returns an output argument that contains information about the simulation run, such as model outputs, when the simulation is finished.
Please note that the exact format of the output argument will depend on the how the options in the Model Configuration Paramters > Data Import/Export pane are set.
For example if the model is set to 'Save simulation output as single object' then following line of code could be used to run the simulation and report results:
>> simOut = sim(modelName);
When integrating this with a MATLAB App this function call would be placed in the callback function of a button. The button would run the above command and then use the simOut Simulink.SimulationOutput object to display or save results to a file.
Another method of observing the input or output signal to a block while a Simulink simulation is running is to use a Simulink Event Listener. An event listener in Simulink waits for a specific event such as the 'PostOutputs' event which fires just after the outputs of the block are computed. When this event is run Simulink will call the function handle that was provided when the event listener was registered. When the function is called it will be passed variables that can be used to determine input or output values of the block.
For more information about this workflow please see the following documentation pages:
The following answers from the community might be of relevance to you.
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!