save/assign variables in parfor loop

조회 수: 18 (최근 30일)
youngeun
youngeun 2014년 4월 10일
편집: youngeun 2014년 4월 10일
Hello, Matlab experts.
I would like to do imaging processing with parfor iteration. Here is my simple example code. I wonder that how I can save/store variable resulting from the function in parfor loop. Thank you very much for your help in advance.
  • *
a; % 128x128 image
b; % 128x128 image
result=zeros(128,128,2);
parfor row=1:128
for column=1:128
[plus,minus] = myfun(a(row, column), b(row,column));
% myfun is "a-b" and "a+b", return two outputs
result(row, column, 1)= plus;
result(row, column, 2)= minus;
end
end
figure; imagesc(result(:,:,1));
figure; imagesc(result(:,:,2));* *

답변 (0개)

카테고리

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