function handle, parfor loop, matlab 2018 possible bug

13 ビュー (過去 30 日間)
Daniele Perissin
Daniele Perissin 2018 年 9 月 25 日
コメント済み: chakwai 2024 年 4 月 8 日
I cut and paste pieces of code just to reproduce the issue
beta = 0.75;
relfiltlen = 6;
decfactor = 4096;
pedestal = 0;
weight = 1;
RK = sinc_hann(beta, relfiltlen, decfactor, pedestal, weight);
kernel_tab = RK.r_fintp(decfactor*RK.i_intplength/2+1:RK.i_filtercoef);
R = makeresampler({RK.i_intplength/2, kernel_tab}, 'fill');
cwin=2; covs=2;
osxy = cwin/2:1/covs:cwin/2+2;
[os_xi, os_yi] = meshgrid(osxy, osxy);
tmap = cat(3, os_yi, os_xi);
parfor i=1:10
corros = tformarray(ones(10), [], R, [1 2], [1 2], [], tmap, []);
end
Here clearly the parfor is useless, but again, it is just to reproduce the problem. This piece of code works in every matlab version, but in 2018 it returns an error: "Undefined function handle".
At the time the parfor prepares to start, a warning: "Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2018a\toolbox\images\images\private\resampsep.mexw64>resampsep"
R.resamp_fcn
is a funtion handle and it contains
@resampsep
however, from inside the parfor loop, the function handle is set as
'UNKNOWN Function'
The code in fact works if executed in a for loop.
So, it seems in Matlab 2018 some function handles checks have been implemented which were not there in previous matlab versions.
resampsep
is a private function of the image processing toolbox, visible from within the toolbox libraries but not at the time of parfor "compilation". Here probably the reason of the failure of the check.
Whatever the reason, it causes incompatibility issues between different Matlab versions and I think it should be corrected or changed.
Thanks
dp
  5 件のコメント
Daniele Perissin
Daniele Perissin 2018 年 9 月 26 日
It looks like the issue was solved in 2018b.
chakwai
chakwai 2024 年 4 月 8 日
It seems like that one uses parallel computing to run the function will face this issue. I used parallel computing to carry out the multistart optimization and got the same error like urs. Did u find out that whether there is a corrective way for this issue without downloading the matlab of a more latest version?

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by