필터 지우기
필터 지우기

How to use parallel processing with varying internal variable

조회 수: 2 (최근 30일)
Shashi
Shashi 2013년 12월 5일
편집: Matt J 2013년 12월 5일
This is a simple code, i am uploading for illustration. Can somebody suggest how to use all the four cores of a system with varying internal variables, as given in the code below:
b = 2; bi = zeros(10,1);
matlabpool open
parfor i = 1:100 %#ok<PFUNK>
a(i) = b+ bi(i);
b(i+1) = a(i);
end
matlabpool close
Regards

답변 (1개)

Matt J
Matt J 2013년 12월 5일
편집: Matt J 2013년 12월 5일
The first thing would be to re-express the body of the loop as something parallelizable, in your case
parfor i = 1:100
a(i) = b*i;
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by