Error while running ga code. How to use function handler .? Undefined function or variable 'FcnArgs'
19 views (last 30 days)
Show older comments
I have error while running my M file.
My function handler is as follows
h=@(x) rmse_test(x,FcnArgs{net:inputs:target});
But i'm getting error like this
Undefined function or variable 'FcnArgs'.
Error in genetic_algorithm (line 25)
h = @(x) rmse_test(x,FcnArgs{net:inputs:targets});
createAnonymousFcn is inbuilt function like this
function fcn_handle = createAnonymousFcn(fcn,FcnArgs)
%CREATEFUNCTIONHANDLE create an anonymous function handle
%
% fcn: A function handle
% args: A cell array of extra arguments to user's objective/constraint
% function
% Copyright 2011 The MathWorks, Inc.
% $Revision: 1.1.6.1 $Date: 2011/10/27 00:34:50 $
fcn_handle = @(x) fcn(x,FcnArgs{:});
Could anyone help me to solve this error..??
0 Comments
Answers (1)
Walter Roberson
on 5 Apr 2016
Your function handler should not be that. Your function handler should be the result of calling
createAnonymousFcn( @rmse_test, {net, inputs, target})
3 Comments
Walter Roberson
on 5 Apr 2016
h = createAnonymousFcn( @rmse_test, {net, inputs, target});
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!