Access app designer variables in Simulink
11 views (last 30 days)
I am trying to make an interface around a simulink simulation using app designer. An user should be able to input values for certain parameters. When he/she clicks "Simulate", the application should simulate the Simulink model with the given parameters. The application and simulink file are in the same folder. I used the code below to set parameters and simulate the model. However, I get the error 'Undefined function or variable [...] Variable does not exist'. In other words, the Simulink model cannot access the variables created in the app designer. Any suggestions? FYI: running the Simulink file from a Matlab script works fine.
Variable1 = app.Variable1.Value;
Variable2 = app.Variable2.Value;
simOut = sim('simulinkFile','ReturnWorkspaceOutputs','on');