UnableToRe​solveHidde​nFunction

2 ビュー (過去 30 日間)
Sanjay Manohar
Sanjay Manohar 2019 年 7 月 5 日
コメント済み: Guillaume 2019 年 7 月 5 日
I'm calling a function that I stored in a structure as a function handle. I get the following error
Unable to find function @(p1)forwardsModel(params) within /media
/cogneuro/fit3.m
with identifier:
identifier: 'MATLAB:dispatcher:UnableToResolveHiddenFunction'
The structure is created in file fit3.m:
function result = fit3
for i=1:N
for j=1:M
params = createParameters(i,j);
result{i}(j).forwardsModel = @(p1)forwardsModel(params,p1)
[result{i)(j).optimP, result{i}(j).optimNLL] = ...
fmincon( result{i}(j).forwardsModel, zeros(1,NP) );
end
end
return
function negloglikelihood = forwardsModel(p,u)
... % calculate likelihood of model
return
I create the functions like this
result = fit3; % this works fine
save fit3_functions result % this works fine
then later I retrieve the fits
load fit3_functions % this works fine too
The I call
x = result{1}(1).forwardsModel(p0_actual);
and get the above error. I am not sure exactly what conditions reproduce this problem, as it sometimes works.
Any thoughts on
  • what this error means,
  • why it might be triggered in this situation, and
  • how I might avoid it happening?
  1 件のコメント
Guillaume
Guillaume 2019 年 7 月 5 日
does loading with:
matcontent = load('fit3_functions');
result = matcontent.result;
x = result{1}(1).forwardsModel(p0_actual);
fix the problem?
If not, what is the output of
functions(result{1}(1).forwardsModel)

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by