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

33 views (last 30 days)

Answers (1)

Pramil
Pramil on 24 Nov 2024 at 18:07
Edited: Pramil on 24 Nov 2024 at 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 Comments
Zhiyun Zhang
Zhiyun Zhang on 25 Nov 2024 at 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 on 25 Nov 2024 at 4:00
Edited: Pramil on 25 Nov 2024 at 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".

Sign in to comment.

Categories

Find more on Run Model Advisor Checks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!