Why does “setVariable” in Simulink Test not update variables?

Technical Source
1 min readAug 31, 2021

--

I’m using “setVariable” to update a variable in a test harness. I’m using the command

evalin('base', 'y_coordinate')

in a “From Workspace” block to load the variable into Simulink.

However, in R2019b the variable doesn’t seem to get updated. Why does this happen?

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.

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

SEE COMPLETE ANSWER CLICK THE LINK

https://www.matlabsolutions.com/resources/why-does-setvariable-in-simulink-test-not-update-variables-.php

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet