function handle, parfor loop, matlab 2018 possible bug

조회 수: 12 (최근 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 CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by