How can I show Matlab Simulink Data in Matlab App Designer?

79 ビュー (過去 30 日間)
Maik Korinek
Maik Korinek 2021 年 1 月 8 日
コメント済み: Maik Korinek 2021 年 1 月 19 日
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 件のコメント
Mario Malic
Mario Malic 2021 年 1 月 8 日
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.

サインインしてコメントする。

採用された回答

Jemima Pulipati
Jemima Pulipati 2021 年 1 月 11 日
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.
An event listener can be registered by using the add_exec_event_listener function.
For more information about this workflow please see the following documentation pages:
The following answers from the community might be of relevance to you.
  1 件のコメント
Maik Korinek
Maik Korinek 2021 年 1 月 19 日
Thanks for your help, this was helpfull! :-)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Model Editing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by