Function or variable 'ms1' not recognized
조회 수: 4 (최근 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!