フィルターのクリア

parfor cannot run due to the way the variable 'Adj_Load_Mat' is used

1 回表示 (過去 30 日間)
Diab Abueidda
Diab Abueidda 2019 年 1 月 31 日
コメント済み: Diab Abueidda 2019 年 2 月 1 日
Hello,
I am trying to run the following parfor loop, but I keep getting an error. The error message says "parfor cannot run due to the way the variable 'Adj_Load_Mat' is used." Any workaround is highly appreciated.
Adj_Load_Mat=zeros(tne,ndof);
parfor iel=1:tne
dof=dof2(iel,:);
Adj_Load_Mat(iel,dof)=(Ad_Load_e(iel,:))';
end
Adj_Load=sum(Adj_Load_Mat,1);
The arrays 'Ad_Load_e' and 'dof2' are calculated at previous steps.
Thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 31 日
Try
Adj_Load_Mat=zeros(tne,ndof);
parfor iel=1:tne
dof=dof2(iel,:);
local_Adj = Adj_Load_Mat(iel, :);
%it has to end up as column the transpose portion of ' must be
%irrelevant so you must have used ' to indicate conjugate
local_Adj(dof) = conj(Ad_Load_e(iel, :));
Adj_Load_Mat(iel,:) = local_Adj;
end
Adj_Load=sum(Adj_Load_Mat,1);
  2 件のコメント
Diab Abueidda
Diab Abueidda 2019 年 1 月 31 日
Thanks, Walter! It worked.
Diab Abueidda
Diab Abueidda 2019 年 2 月 1 日
Hi Walter,
I am encountering a bit different scenario, but the error is the same as the old one
Thanks in advance
parfor iel=1:tne
start=(iel-1)*576+1;
end1=576*iel;
data(start:end1)=data2(iel,:);
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by