如何在MATLAB中进行线程化? [英] How to do threading in MATLAB?
问题描述
如何在MATLAB中进行线程化?我想同时在两个变量上运行一个函数。我该怎么做?
并行工具箱有一些工具可以帮助您。从Matlab帮助中查找下面的一些示例
matlabpool%使用默认并行配置
spmd%默认情况下使用所有实验在池中
INP = load(['somedatafile'num2str(labindex)'.mat']);
RES = somefun(INP);
end
然后 您也可以将 How to do threading in MATLAB? I want to run one function on two variables simultaneously. How do I do it? The parallel toolbox has some tools that might help you. Find below some example pasted from the Matlab help Then the values of You might also look at 这篇关于如何在MATLAB中进行线程化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! RES
在实验室可以从客户端以 RES {2}
从实验室2等。
parfor
视为的
。希望这有助于即使它不是你正在寻找的。 p> matlabpool % Use default parallel configuration
spmd % By default uses all labs in the pool
INP = load(['somedatafile' num2str(labindex) '.mat']);
RES = somefun(INP);
end
RES
on the labs are accessible from the client as RES{1}
from lab 1, RES{2}
from lab 2, etc.parfor
as a simple parallel replacement of for
. Hope this helps even if it's not exactly what you're looking for.