Main Content

evalin

Evaluate MATLAB expression in data dictionary section

Description

returnValue = evalin(sectionObj,expression) evaluates a MATLAB expression in the data dictionary section sectionObj and returns the values returned by expression.

To programmatically access variables for the purpose of sweeping block parameter values, consider using Simulink.SimulationInput objects instead of modifying the variables through the programmatic interface of the data dictionary. See Optimize, Estimate, and Sweep Block Parameter Values.

example

Examples

collapse all

Represent the Design Data section of the data dictionary myDictionary_ex_API.sldd with a Simulink.data.dictionary.Section object named dDataSectObj.

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

Execute the whos command in the Design Data section of myDictionary_ex_API.sldd.

evalin(dDataSectObj,'whos')
   Name                 Size            Bytes  Class                 Attributes

  fuelFlow             1x1                 8  double                          
  myRefEntry           1x1                 1  logical                         
  parameterGain37      1x1               112  Simulink.Parameter              

Input Arguments

collapse all

Target data dictionary section, specified as a Simulink.data.dictionary.Section object. Before you use this function, represent the target section with a Simulink.data.dictionary.Section object by using, for example, the getSection function.

MATLAB expression to evaluate, specified as a character vector.

Example: 'a = 5.3'

Example: 'whos'

Example: 'CurrentSpeed.Value = 290.73'

Data Types: char

Tips

  • evalin allows you to treat a data dictionary section as a MATLAB workspace. You can think of entries contained in the section as workspace variables you can manipulate with MATLAB expressions.

Version History

Introduced in R2015a

Go to top of page