'How to check the text syntax of a Simulink model
I want to check if the mdl file of a Simulink model is syntactically correct or not. I don't want to load the model because I am only interested in the syntax errors, not the semantic issues (i.e. unconnected lines, etc.) Consider the example:
Model {
Name toy
System {
Name toy
Block {
BlockType DiscreteTransferFcn
Name "cfblk1"
}
Block {
BlockType Display
Name "cfblk2"
}
Line {
SrcBlock "cfblk1"
SrcPort 1
DstBlock "xyz"
DstPort 1
}
}
}
Here, the model is syntactically correct, but semantically the Line is not correct. Because there is no existing Block titled xyz. If I load the model then it will raise warnings:
Warning: sample.mdl, line 18: Attempt to set DstPort with invalid Destination
> In load_system (line 21)
Is there any way to validate the syntax of mdl files without loading them into memory?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
