Why am I getting an “Incompatible global variables” after creating a protected reference model?
have a reference model that uses global Simulink parameters declared in the base workspace and after creating a protected model from it, I get the following error when trying to simulate the model from a function with different values for the Simulink parameters:
“One or more global variables used by protected model are incompatible with the variables that existed when the model was created.”
Why do I get this error?
ANSWER
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
1) A reason why you might get that error is if the parameters are in the function’s workspace so they are not accessible to the model. You can resolve this issue by including the following in your function:
>> assignin('base','name_of_var', name_of_variable);
2) Another reason why you might be getting that error is if the Simulink parameters are created with values of some dimensions and then called with values of different dimensions. For example if you have the following case:
You create the reference model and protected model while the following variable (used in the model) is in the workspace:
SEE COMPLETE ANSWER CLICK THE LINK