Error using parfor on for loop

1 回表示 (過去 30 日間)
Tino
Tino 2019 年 7 月 3 日
回答済み: Edric Ellis 2019 年 7 月 4 日
Hi Please I am getting the followign error running parfor. kindly assist
fnP = @ (a,i) ( sum ( a(i) > a(1:i) + 0.5));
a = mova (:, :);
I am using
parfor j = 1 : mf
m{j} = (fnP(mova, j);
end
I am getting the error below:
Error using parfor_sliced_fcnhdl_check (line 9)
The sliced variable fnP must not refer to a function handle. To invoke the function handle in the parfor loop, use "feval(fnP, args)". For more information see Parallel Computing Toolbox, "parfor".
Error in kiamean (line 50)
parfor j = 1 : mf

採用された回答

Edric Ellis
Edric Ellis 2019 年 7 月 4 日
Did you try the suggestion from the error message, i.e.
parfor j = 1:mf
m{j} = feval(fnP, mova, j);
end
That should work.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by