function handle, parfor loop, matlab 2018 possible bug

12 views (last 30 days)
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 Comments
chakwai
chakwai on 8 Apr 2024
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?

Sign in to comment.

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!