How can I display errors with custom error checking rules like shown in the picture

33 Ansichten (letzte 30 Tage)
Zhiyun Zhang
Zhiyun Zhang am 22 Nov. 2024 um 15:42
Bearbeitet: Pramil am 25 Nov. 2024 um 4:01

Antworten (1)

Pramil
Pramil am 24 Nov. 2024 um 18:07
Bearbeitet: Pramil am 24 Nov. 2024 um 18:13
Hello Zhiyun,
To create custom checks in Simulink, you can utilize the "Model Advisor" tool. Visit the following link for more information:
The Simulink "Model Advisor" comes with a set of default checks for models, but you can also add your own custom checks. For instructions on how to "Define Custom Model Advisor Checks," please refer to this documentation:
Additionally, you might find this page helpful, as it includes an example you can follow to meet your specific requirements:
Hope it helps.
  2 Kommentare
Zhiyun Zhang
Zhiyun Zhang am 25 Nov. 2024 um 1:57
Hi Pramil,
Thanks for your answers.
However, I would like to clarify a few points regarding my question.
Firstly, I did not use any tools; the error was automatically detected by Simulink when the line was connected.
Secondly, the format of this error prompt is what I'd like to figure out. I’m wondering if there’s an API that allows me to check errors based on my custom rules, like in the picture, without having to open tools like "Model Advisor."
I really appreciate your response and attention.
Pramil
Pramil am 25 Nov. 2024 um 4:00
Bearbeitet: Pramil am 25 Nov. 2024 um 4:01
Regarding the error, it occurs when Simulink is not able to find a variable, in your case variable named "GeBSW_MCUResetCause_enum", which could be resulted due to:
  • Using functions such as "clear".
  • Opening new MATLAB session without loading the variable at "base workspace" first.
  • Having wrong variable name in "base workspace".
As for the custom rules, can you elaborate on that part? If you want to load data or check if variables are present when model opens, you can write a script for the same in "Modelling->Model Properties->Callbacks->PreLoadFcn".

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Run Model Advisor Checks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by