wait
Simulink.Simulation.Future
オブジェクトがシミュレーションを完了するまで待機する
説明
例
Future
配列がシミュレーションを完了するまで待機する
この例は、wait
メソッドを future
オブジェクトの配列に使用する方法を示します。
この例では、ゲイン Mu の値を変化させて、vdp
モデルの複数のシミュレーションを実行します。
モデルを開き、Mu の値のベクトルを定義します。
open_system('vdp');
Mu_Values = [0.5:0.25:5];
MuVal_length = length(Mu_Values);
Mu_Values
を使用して、Simulink.SimulationInput
オブジェクトの配列を初期化します。配列を事前に割り当てるために、ループ インデックスは最大値から開始されるように作成します。
for i = MuVal_length:-1:1 in(i) = Simulink.SimulationInput('vdp'); in(i) = in(i).setBlockParameter('vdp/Mu',... 'Gain',num2str(Mu_Values(i))); end
parsim
を使用して、モデルのシミュレーションを実行します。シミュレーション実行中にコマンド プロンプトを利用できるようにし、Simulink.Simulation.Future
オブジェクトの配列を作成するには、'RunInBackground
' を設定します。
Future = parsim(in,'RunInBackground','on');
wait
メソッドを Future
に使用して、実行をブロックします。
Ok = wait(Future)
入力引数
Future
— Simulation.Simulink.Future
オブジェクト
配列
Simulation.Simulink.Future
オブジェクトの配列。Future
を作成するには、'RunInBackground'
オプションを 'on'
に設定して parsim
を実行します。
例: Future = parsim(in,'RunInBackground','on')
出力引数
Ok
— 待機が正常に完了したか
1 | 0
Ok
は、待機が正常に完了した場合は true
になり、いずれかの Future
オブジェクトの実行が失敗またはキャンセルされた場合は false
になります。true の場合は 1、false の場合は 0 として指定します。
バージョン履歴
R2017b で導入
参考
関数
クラス
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは 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)