Matlab spmd Collecting Composite Arrays

6 ビュー (過去 30 日間)
Ibrahim KAYA
Ibrahim KAYA 2023 年 3 月 10 日
コメント済み: Ibrahim KAYA 2023 年 3 月 13 日
Hi everyone,
I have been working on Matlab spmd with OOP, but I have received this error;
"Dot invocation is not allowed for Composites, use the functional form instead."
my codes;
spmd
.....
......
.....
end
A0 = hx.Tis_pr(:);
hx.Tis = [];
for i = 1:hx.Converge.CoreNumber
hx.Tis = [hx.Tis,A0(i)];
end
I will be glad if you can help....
best regard....

採用された回答

Edric Ellis
Edric Ellis 2023 年 3 月 13 日
You missed a crucial clue from your question - where are you assigning hx. I'm going to guess you have something like this:
spmd
hx = doSomething(); % assign hx
end
Outside the spmd block, hx is a Composite . What that means is that the contents of hx are left remaining on the workers, and only brought back to the client when you request them. You can get the value from worker 1 like this:
worker1_hx = hx{1};
% Now you can work with local data worker1_hx:
worker1_A0 = worker1_hx.Tis_pr(:);
You can get all the different hx values from each worker as a cell array by doing this:
all_hx = hx(:);
for idx = 1:numel(all_hx)
worker_hx = all_hx{idx};
worker_hx.Tis; % Access fields of one element
end
  1 件のコメント
Ibrahim KAYA
Ibrahim KAYA 2023 年 3 月 13 日
static method can be used. Structural parameter including spmd blocks is very dangerous.....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Parallel Server についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by