Simple parallel execution in MATLAB

后端 未结 3 1946
天命终不由人
天命终不由人 2021-01-16 20:12

I have figured out some awesome ways of speeding up my MATLAB code: vectorizing, arrayfun, and basically just getting rid of for loops (not using parfor). I want to take it

3条回答
  •  梦谈多话
    2021-01-16 20:43

    If I am optimistic I think you ask "How Can I simply do parallel processing in Matlab". In that case the answer would be:

    Parallel processing can most easily be done with the parallel computing toolbox. This gives you access to things like parfor.

    I guess you can do:

    parfor t = 1:2
       if t == 1, x = fun(a); end
       if t == 2, y = fun(b); end
    end
    

    Of course there are other ways, but that should be the simplest.

提交回复
热议问题