function handle, parfor loop, matlab 2018 possible bug
이전 댓글 표시
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
Edric Ellis
2018년 9월 25일
Thanks for reporting this - I think I can see the same problem (your code isn't executable for me, but I do think I know what's going wrong), but I want to be sure - what version of MATLAB does this work correctly in?
Daniele Perissin
2018년 9월 25일
Daniele Perissin
2018년 9월 26일
Daniele Perissin
2018년 9월 26일
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개)
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!