フィルターのクリア

How to run two Matlab programs simultaneously?

5 ビュー (過去 30 日間)
DhanaLakshmiR
DhanaLakshmiR 2018 年 1 月 11 日
コメント済み: DhanaLakshmiR 2018 年 1 月 17 日
The arguments are passed from program1 is to be considered as input for program2. program2 have to work with these inputs and it iteratively give the results. Now each and every iteration that results have to be used as input to program1.Both have to made simultaneously.Is it possible to make this?kindly give answers.

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 11 日
You can use the parallel computing toolbox with a pool of size 2. use spmd and test labIndex to determine which of the two programs you need to execute. The two parts should use labSend and labReceive to communicate.
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 1 月 11 日
parpool(2)
spmd
first_run = true;
while true
if labIndex == 1
if first_run
A_parameters = initial_parameters_for_A;
first_run = false;
else
A_parameters = labReceive();
end
A_output = A(A_parameters);
B_parameters = make_B_parameters(A_output);
labSend(B_parameters, 2);
else
B_parameters = labReceive();
B_output = B(B_parameters);
A_parameters = make_A_parameters(B_output);
labSend(A_parameters, 1);
end
end
end
DhanaLakshmiR
DhanaLakshmiR 2018 年 1 月 17 日
Thanks a lot for your answer.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by