exist
检查 Composite 是否在工作单元上定义
语法
h = exist(C,labidx)
h = exist(C)
说明
h = exist(C,labidx),如果 Composite true 中的条目在 C 为 spmdIndex 的工作单元上具有定义的值,则函数返回 labidx,否则返回 false。一般情况下 labidx 为数组,输出 h 为与 labidx 大小相同的数组,h(i) 表示 Composite 项 labidx(i) 是否具有定义的值。
h = exist(C) 等同于 h = exist(C, 1:length(C))。
如果 exist(C,labidx) 返回 true,则 C(labidx) 不会抛出错误,前提是这些工作单元上的 C 的值是可序列化的。如果任何 labidx 无效,该函数将抛出错误。
示例
定义一个随机工作单元数量的变量。检查 Composite 条目在哪些工作单元上定义,并获取所有这些值:
spmd if rand() > 0.5 c = spmdIndex; end end ind = exist(c); cvals = c(ind);
版本历史记录
在 R2008b 中推出