"Unrecognized function or variable" error due to unrecognized function, which is indeed defined.

I got the following error message:
Unrecognized function or variable 'Afunc'.
Error in update_xf>@(x)Afunc(x,CGparams) (line 80)
Afunc = @(x)Afunc(x, CGparams);
Error in CG (line 4)
r = rhs - Afunc(x);
Error in update_xf (line 82)
[xf{i}, noit_cg]=CG(xf{i}, Afunc, (1/sigma2^2)*rhs{i}, CG_MAX_ITER, CG_TOL);
But the function Afunc is defined at the end of file update_xf:
function Ax = Afunc(x, params)
Ax = (1/params.sigma2^2)*conv2(conv2(x,params.k,'same').*params.mask, flip(params.k),'same');
Ax = Ax + params.weights.*x;
end
The call to CG is done in update_xf as:
Afunc = @(x)Afunc(x, CGparams);
[xf{i}, noit_cg]=CG(xf{i}, Afunc, (1/sigma2^2)*rhs{i}, CG_MAX_ITER, CG_TOL );
And in CG to Afunc as:
function [x_new,it]=CG(x, Afunc, rhs, CG_MAX_ITER, CG_TOL)
r = rhs - Afunc(x);
This error happens to me in version 2019b but it is working OK in 2010b

답변 (0개)

카테고리

도움말 센터File Exchange에서 Pattern Data Integration and Visualization에 대해 자세히 알아보기

태그

질문:

2019년 10월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by