copy
Copy operating point or operating point specification
Syntax
op_point2 = copy(op_point1) 
op_spec2 = copy(op_spec1) 
Description
op_point2 = copy(op_point1) returns a copy
                  of the operating point object op_point1. You can create
                        op_point1 with the function
                        operpoint. 
op_spec2 = copy(op_spec1)  returns a copy
                  of the operating point specification object op_spec1. You can
                  create op_spec1 with the function
                  operspec. 
Note
The command op_point2 = op_point1 does
                        not create a copy of op_point1 but instead creates a
                        pointer to op_point1. In this case, any changes made to
                              op_point2 are also made to
                              op_point1. The same is true for operating point
                        specifications. For an example, see Copy an Operating-Point Specification.
Examples
You can create new operspec variables in three ways: 
- Using the - operspeccommand
- Using assignment with the equals ( - =) operator
- Using the - copycommand
Using the = operator results in linked variables that both point to the same underlying data. Using the copy command results in an independent operspec object. In this example, create operspec objects both ways, and examine their behavior.
mdl = 'watertank';
open_system(mdl)
opspec1 = operspec(mdl)opspec1 = 
 Operating point specification for the Model watertank.
 (Time-Varying Components Evaluated at time t=0)
States: 
----------
     x         Known    SteadyState     Min         Max        dxMin       dxMax   
___________ ___________ ___________ ___________ ___________ ___________ ___________
                                                                                   
(1.) watertank/PID Controller/Integrator/Continuous/Integrator
     0         false       true        -Inf         Inf        -Inf         Inf    
(2.) watertank/Water-Tank System/H
     1         false       true          0          Inf        -Inf         Inf    
Inputs: None 
----------
Outputs: None 
----------
Create a new operating point specification object using assignment with the = operator.  
opspec2 = opspec1;
opspec2 is an operspec object that points to the same underlying data as opspec1. Because of this link, you cannot independently change properties of the two operspec objects. To see this, change a property of opspec2. For instance, change the initial value for the first state from 0 to 2. The change shows in the States section of the display.
opspec2.States(1).x = 2
opspec2 = 
 Operating point specification for the Model watertank.
 (Time-Varying Components Evaluated at time t=0)
States: 
----------
     x         Known    SteadyState     Min         Max        dxMin       dxMax   
___________ ___________ ___________ ___________ ___________ ___________ ___________
                                                                                   
(1.) watertank/PID Controller/Integrator/Continuous/Integrator
     2         false       true        -Inf         Inf        -Inf         Inf    
(2.) watertank/Water-Tank System/H
     1         false       true          0          Inf        -Inf         Inf    
Inputs: None 
----------
Outputs: None 
----------
Examine the display of opspec1 to see that the corresponding property value of opspec1 also changes from 0 to 2.
opspec1
opspec1 = 
 Operating point specification for the Model watertank.
 (Time-Varying Components Evaluated at time t=0)
States: 
----------
     x         Known    SteadyState     Min         Max        dxMin       dxMax   
___________ ___________ ___________ ___________ ___________ ___________ ___________
                                                                                   
(1.) watertank/PID Controller/Integrator/Continuous/Integrator
     2         false       true        -Inf         Inf        -Inf         Inf    
(2.) watertank/Water-Tank System/H
     1         false       true          0          Inf        -Inf         Inf    
Inputs: None 
----------
Outputs: None 
----------
To create an independent copy of an operating point specification, use the copy command. 
opspec3 = copy(opspec1);
Now, when you change a property of opspec3, opspec1 does not change. For instance, change the initial value for the first state from 2 to 4. 
opspec3.States(1).x = 4
opspec3 = 
 Operating point specification for the Model watertank.
 (Time-Varying Components Evaluated at time t=0)
States: 
----------
     x         Known    SteadyState     Min         Max        dxMin       dxMax   
___________ ___________ ___________ ___________ ___________ ___________ ___________
                                                                                   
(1.) watertank/PID Controller/Integrator/Continuous/Integrator
     4         false       true        -Inf         Inf        -Inf         Inf    
(2.) watertank/Water-Tank System/H
     1         false       true          0          Inf        -Inf         Inf    
Inputs: None 
----------
Outputs: None 
----------
In opspec1, the corresponding value remains 2. 
opspec1.States(1).x
ans = 2
This copy behavior occurs because operspec is a handle object. For more information about handle objects, see Handle Object Behavior.
You can create new operating-point variables in three ways:
- Using the - operpointfunction
- Using assignment with the equals ( - =) operator
- Using the - copyfunction
Using the = operator results in linked variables that both point to the same underlying data. Using the copy function results in an independent operating-point object. In this example, create operating-point objects both ways, and examine their behavior.
mdl = 'watertank';
open_system(mdl)
op1 = operpoint(mdl)op1 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 0 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------
Create a new operating-point object using assignment with the = operator.  
op2 = op1;
op2 is an operating-point object that points to the same underlying data as op1. Because of this link, you cannot independently change properties of the two operating-point objects. To see this, change a property of op2. For instance, change the value for the first state from 0 to 2. The change shows in the States section of the display.
op2.States(1).x = 2
op2 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 2 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------
Examine the display of op1 to see that the corresponding property value of op1 also changes from 0 to 2.
op1
op1 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 2 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------
To create an independent copy of an operating-point object, use the copy function. 
op3 = copy(op1);
Now, when you change a property of op3, op1 does not change. For instance, change the value for the first state from 2 to 4. 
op3.States(1).x = 4
op3 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 4 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------
In op1, the corresponding value remains 2. 
op1.States(1).x
ans = 2
This copy behavior occurs because the operating-point object is a handle object. For more information about handle objects, see Handle Object Behavior.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)