move
Move element from one path to another
Description
Examples
Rename Element to Match New Block Name
When you rename a block in your model, use the
move
function to update the operating point data.
Open the Permanent Magnet DC Motor example model and create an
OperatingPoint
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
Select the DC Voltage block and find the relative path to this block in the operating point data hierarchy:
oldPath = relativePath(op, gcb)
oldPath = 'DC Voltage'
Rename the DC Voltage block to
1.5V
.
Select the block again and find the new relative path:
newPath = relativePath(op, gcb)
newPath = '1.5V'
Update the operating point data hierarchy to reflect the new block name:
op = move(op, oldPath, newPath)
op = OperatingPoint with children: OperatingPoints: ChildId Size ______________ ____ '1.5V' 1x1 'DC Motor' 1x1 'ERef' 1x1 'Load Torque' 1x1 'MRRef Motor' 1x1 'MRRef Torque' 1x1 'Sensing' 1x1 'Step Input' 1x1
Operating point op
now lists 1.5V
as
its child.
Input Arguments
op
— Operating point
OperatingPoint
object
Original operating point in the workspace, specified as an
OperatingPoint
object.
oldPath
— Relative path to original element
slash-delimited character vector or string scalar
Relative path to the original element in the operating point data tree, specified as a slash-delimited character vector or string scalar. The element can be a subsystem, block, or variable target.
Data Types: char
| string
newPath
— Relative path to new element
slash-delimited character vector or string scalar
Relative path to the new element in the operating point data tree, specified as a slash-delimited character vector or string scalar. The element can be a subsystem, block, or variable target.
Data Types: char
| string
Output Arguments
opNew
— New operating point
OperatingPoint
object
New OperatingPoint
object, which is a copy of the
original OperatingPoint
object, op
,
with element specified by oldPath
moved to the new
location, newPath
. You can move elements recursively,
that is, the name of the new OperatingPoint
object,
opNew
, can be the same as the name of the original
OperatingPoint
object, op
.
Version History
Introduced in R2017b
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)