set - Add or update element of operating point - MATLAB (original) (raw)
Add or update element of operating point
Syntax
Description
[opNew](#d126e123784) = set([op](#d126e123692), [opPath](#d126e123714), [newElement](#d126e123748))
returns a copy of the OperatingPoint
objectop
, with element newElement
added at the specified location in the data tree hierarchy. The new element can be either anotherOperatingPoint
or a Target
. If the element already exists in the operating point, its content is replaced.
Examples
Open the Permanent Magnet DC Motor example model and create anOperatingPoint
object named op
using the Start
values from the model:
openExample('simscape/PermanentMagnetDCMotorExample') op = simscape.op.create(gcs, 'Start')
op =
OperatingPoint with children:
OperatingPoints:
ChildId Size
'DC Motor' 1x1 'DC Voltage' 1x1 'ERef' 1x1 'Load Torque' 1x1 'MRRef Motor' 1x1 'MRRef Torque' 1x1 'Sensing' 1x1 'Step Input' 1x1
Create a Target
object named t
, consisting of a numeric value, unit, and initialization priority:
t = simscape.op.Target(1.5, 'A', 'High')
t = Target with fields:
Value: 1.5000 : A
Priority: High
Attributes: containers.Map Description:
Add the target t
to the operating pointop
by assigning this target to the Inductor current variable, i_L
, of the Rotor Inductance block in the DC Motor subsystem:
op = set(op, 'DC Motor/Rotor Inductance/i_L', t);
Input Arguments
The original operating point in the workspace, specified as anOperatingPoint
object, to which you are adding the new element.
Location where you want to add the new element, specified as a slash-delimited character vector or string scalar. Define the location by the path through the data tree hierarchy of the original operating point,op. Separate the tree node names with slash symbols (/
). You can use therelativePath
function to determine the path.
Example: 'DC Motor/Rotor Resistance'
Data Types: char
| string
Element to be added to the original OperatingPoint
object, op, specified as anOperatingPoint
or a Target
object.
Output Arguments
New OperatingPoint
object, which is a copy of the original OperatingPoint
object, op, with newElement added at theopPath location. You can add elements recursively, that is, the name of the new OperatingPoint
object,opNew
, can be the same as the name of the originalOperatingPoint
object, op
.
Version History
Introduced in R2017b