>> Z = server.rpc('zeros', 2, 3);
>> Z =
[2x3 double] [2x3 double]
>> Z{1}
ans =
0 0 0
0 0 0
>> Z = server.rpc('zeros', {2,3}, {4,5});
>> Z =
[2x4 double] [3x5 double]
This runs 'zeros' on each slave, but rather than using the same
arguments for both slaves, it passes 2,4 to the first slave, and
3,5 to the second slave. Note that in Example 1 the arguments
were implicitly converted to {2,2}, {3,3} internally.
每个参数用大括号包起来,用逗号分割各个参数来在不同slave上运行。
[M,N]=server.rpc('size', { [1 2 3 4], [1 2]' });
>> M
M =
[1] [2]
>> N
N =
[4] [1]
本文通过示例展示了如何使用RPC进行远程过程调用,包括初始化零矩阵和获取矩阵大小的方法。对于不同slave节点,可以传递不同的参数,实现灵活的数据处理。
613

被折叠的 条评论
为什么被折叠?



