Main Content

evalin

Class: Simulink.data.dictionary.Section
Package: Simulink.data.dictionary

Evaluate MATLAB expression in data dictionary section

Syntax

returnValue = evalin(sectionObj,expression)

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.

Input Arguments

expand 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

Examples

expand 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              

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.

Introduced in R2015a