Protect model incompatible global variable error after changing the variable value
조회 수: 8 (최근 30일)
이전 댓글 표시
I select a structure as a tunable parameter of a protect model, the protect model runs well as the structure remains unchanged. Butthe protect model cannot run as soon as I change the value of the structure element, and an error: "One or more global variables used by protected model 'D:\protect model\CarModel1_1_protected2\CarModel_Protected.slxp" are incompatible with the variables that existed when the protected model was created. Incompatible global variables: CarWheel." occured. What should I do to solve this?
댓글 수: 0
답변 (1개)
Meet
2025년 8월 4일
This error can occur if parameters are only in the function's workspace (not the base workspace) or if there is a mismatch in parameter dimensions between when the model was protected and when it is used. To fix this, use the below code snippet and ensure parameter dimensions match.
assignin('base', 'varName', varName)
For more detailed information, please refer to this MathWorks article: https://www.mathworks.com/matlabcentral/answers/439026-why-am-i-getting-an-incompatible-global-variables-after-creating-a-protected-reference-model
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Model Protection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!