copy
操作点または操作点仕様のコピー
構文
op_point2 = copy(op_point1)
op_spec2 = copy(op_spec1)
説明
op_point2 = copy(op_point1) は op_point1 操作点オブジェクトのコピーを返します。関数 operpoint を使用して、op_point1 を作成できます。
op_spec2 = copy(op_spec1) は op_spec1 操作点仕様オブジェクトのコピーを返します。関数 operspec を使用して、op_spec1 を作成できます。
メモ
op_point2=op_point1 コマンドは、op_point1 のコピーを作成するのではなく、op_point1 のポインターを作成します。この場合、op_point2 に加えた変更が op_point1 にも反映されます。操作点の仕様についても同様です。例については、操作点の仕様のコピーを参照してください。
例
新しい operspec 変数は次の 3 つの方法で作成することができます。
operspecコマンドを使用する等号 (
=) 演算子による割り当てを使用するcopyコマンドを使用する
= 演算子を使用すると変数がリンク付けられ、どちらの変数も基となる同じデータを指しています。copy コマンドを使用すると、独立した operspec オブジェクトになります。この例では operspec オブジェクトを両方の方法で作成し、それらの動作を検証します。
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
----------
= 演算子による割り当てを使用して、新しい操作点の仕様オブジェクトを作成します。
opspec2 = opspec1;
opspec2 は、opspec1 と同じ基となるデータを指す operspec オブジェクトです。このリンクのために、2 つの operspec オブジェクトのプロパティを独立して変更することはできません。これを確認するには、opspec2 のプロパティを変更します。たとえば、最初の状態の初期値を 0 から 2 に変更します。変更が画面の States セクションに表示されます。
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
----------
opspec1 の表示を検証し、opspec1 の対応するプロパティ値も 0 から 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
----------
操作点の仕様の独立したコピーを作成するには、copyコマンドを使用します。
opspec3 = copy(opspec1);
ここで、opspec3 のプロパティを変更しても、opspec1 は変更されません。たとえば、最初の状態の初期値を 2 から 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
----------
opspec1 では、対応する値は 2 のままです。
opspec1.States(1).x
ans = 2
このコピー動作が発生するのは、operspec が "ハンドル オブジェクト" であるためです。ハンドル オブジェクトの詳細については、ハンドル オブジェクトの動作を参照してください。
新しい operating-point 変数は次の 3 つの方法で作成することができます。
関数
operpointを使用する等号 (
=) 演算子による割り当てを使用する関数
copyを使用する
= 演算子を使用すると変数がリンク付けられ、どちらの変数も基となる同じデータを指しています。関数 copy を使用すると、結果として独立した操作点オブジェクトが作成されます。この例では操作点オブジェクトを両方の方法で作成し、それらの動作を検証します。
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 ----------
= 演算子による割り当てを使用して、新しい操作点オブジェクトを作成します。
op2 = op1;
op2 は、op1 と同じ基となるデータを指す操作点オブジェクトです。このリンクのために、2 つの操作点オブジェクトのプロパティを独立して変更することはできません。これを確認するには、op2 のプロパティを変更します。たとえば、最初の状態の値を 0 から 2 に変更します。変更が画面の States セクションに表示されます。
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 ----------
op1 の表示を検証し、op1 の対応するプロパティ値も 0 から 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 ----------
操作点オブジェクトの独立したコピーを作成するには、copyコマンドを使用します。
op3 = copy(op1);
ここで、op3 のプロパティを変更しても、op1 は変更されません。たとえば、最初の状態の値を 2 から 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 ----------
op1 では、対応する値は 2 のままです。
op1.States(1).x
ans = 2
このコピー動作が発生するのは、操作点オブジェクトが "ハンドル オブジェクト" であるためです。ハンドル オブジェクトの詳細については、ハンドル オブジェクトの動作を参照してください。
バージョン履歴
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)