Write and Read Variable into Simulink Model via Matlab or other

4 次查看(过去 30 天)
Hi i would like to change value of variable in input and read the output of this model.
The main target is to write a scenari to validate all the logic of the model with a simple execution and generate a report with PASSED/FAILED status if all steps have been done correctly.
Thanks for your help.

回答(1 个)

Anshuman
Anshuman 2023-3-21
Hi Cyril,
To change the value of variable in input:
Open the Model Explorer. On the Modeling tab, click Model Explorer. In the Model Explorer Model Hierarchy pane, select the model workspace. In the Contents pane, select the variable. In the Contents pane or in Dialog pane, edit the value displayed.
To read the output, as soon as the simulation completes, an output variable is generated in the MATLAB workspace, which you can load and read the outputs.
For validating the logic and generating the report , you can use Design verifier app. It gives you some test cases and generates a coverage report, which displays the status of PASSED/FAILED of the objectives in those test cases.
To use Design verifier, go to APPS section in simulink strip, select the mode as Test Generation and Click on Generate Tests.
Hope this helps!

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by