Suppose I have two functions written in different scripts, say function1.mand function2.m. Two calculations in two functions are independent (some inputs may be the same, for example, function1(x,y)and function2(x,z)). However, working sequentially, say, ret1 = function1(x,y); ret2 = function2(x,z);can be time consuming. I wonder if it can be run in a loop parfor:
parfor i = 1:2
ret(i) = run(['function' num2str(i)]); % if i=1,ret(1)=function1 and i=2, ret(2)=function2
end
Is it possible to write it in a loop parfor?
source
share