Function or variable 'ms1' not recognized
6 ビュー (過去 30 日間)
古いコメントを表示
matlab2022b生成嵌入式代码报错
Function or variable 'ms1' not recognized
本人是手动点击生成代码(Ctrl+B),并没有想过的脚步,
I manually clicked to generate the code (Ctrl+B) and did not take any steps forward,
Simulink会有时候弹出这个问题,我认为是simulink 自身的问题
Simulink sometimes pops up this issue, and I think it's a problem with Simulink itself
大家有没有遇到过类似的
Have you ever encountered something similar

0 件のコメント
回答 (1 件)
Shishir Reddy
2025 年 6 月 27 日
The error "Function or variable 'ms1' not recognized" usually means that Simulink or MATLAB cannot find a definition for 'ms1' in the current context. This is likely not a bug in Simulink itself, but rather due to one of the following -
1. Missing Workspace Variable: If 'ms1' is supposed to be a variable, make sure it is defined in the MATLAB base workspace before generating code (Ctrl+B). This can be checked by typing 'whos' in the Command Window.
2. Unresolved Block/Function Name: If 'ms1' refers to a block or model component, make sure it exists in your model and is correctly referenced. Sometimes renaming or deleting blocks can leave stale references.
3. Model Callbacks or Scripts: Check if your model relies on any 'InitFcn' callbacks or 'LoadFcn' scripts to initialize variables like 'ms1'. If those scripts are not executed, the variable might not exist.
I hope this helps
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Deployment, Integration, and Supported Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!