Hi all,
I'm new to parallel computing in MATLAB, please forgive my simple question.
I have a test code like this, while I'd like to extract the otpt matrix at 10000th iteration:
inpt = rand(5);parfor i = 1:10000 otpt = sin(inpt);end
After running this paralleled code, no error appears, but if I call otpt:
>> otptUndefined function or variable 'otpt'.
What if I need the value of otpt?
I did something like this:
inpt = rand(5);temp = zeros(5);parfor i = 1:10000 otpt = sin(inpt); if i == 10000 temp = temp + otpt; end end
In this way I can extract the value of otpt at 10000th iteration, but intuitively I do not feel this is correct. So how can I get the value of otpt?
Thank you!
Best Answer