In R2019b, the behavior of "setVariable" is modified such that it overrides only model variables (as opposed to MATLAB variables).
I attached a simpler model ("SimpleVars_R2019b.slx") to help illustrate this. This model has two "From Workspace" blocks, one set to "a" and one set to "evalin('base', 'b')".
If you call "findVars" on this model, only "a" is considered to be a model variable, even though both output their timeseries when run:
>> vars = Simulink.findVars('SimpleVars_R2019b')
vars =
VariableUsage with properties:
Name: 'a'
Source: 'base workspace'
SourceType: 'base workspace'
Users: {'SimpleVars_R2019b/From↵Workspace'}
The R2019b behavior provides stricter control of overrides and achieves parity with other Simulink tools. You will need to update the model to use variables which are recognized by Simulink.
Please update the "From Workspace" block variable parameter from "evalin('base', 'y_coordinate')" to just "y_coordinate". Then save the model and run the test file again.
You should observe that "setVariable" updates all of the variables now.
Best Answer