From: Juan Isaza on
I am training a neural network with the function newff. It runs correctly on the normal mode. On the deploy mode the next error is shown:

Network.subsasgn>setAdaptFcn at 1806
Output argument &#8220;err&#8221; <and maybe others> not assigned during call to &#8220;.....\GUI_Oftalmologia_mcr\toolbox\nnet\@network\subsasgn.m<setAdaptFcn>&#8221;.

Error in ==> network.subsasgn at 420
Error in ==> newff>new_5p1 at 181
Error in ==> newff at 108
Error in ==> GUI_Oftalmologia>Oftalmologia/RedNeuronal at 425
Error in ==> GUI_Oftalmologia>Oftalmologia at 207
Error in ==> GUI_Oftalmologia>Calcularbutton_Callback at 96

This error is clearly beacuse of the nexy piece of code in the neural network toolbox:

function [net,err] = setAdaptFcn(net,adaptFcn)

% Disable this property when deployed
if isdeployed, return, end

% Check value
err = '';
if ~ischar(adaptFcn)
err = sprintf('"adaptFcn" must be '''' or the name of a network adapt function.');
return
end
if length(adaptFcn) && ~exist(adaptFcn)
err = sprintf('"adaptFcn" cannot be set to non-existing function "%s".',adaptFcn);
return
end

% Change function
net.adaptFcn = adaptFcn;

% Default parameters
if length(adaptFcn)
net.adaptParam = feval(adaptFcn,'pdefaults');
else
net.adaptParam = [];
end


Explanation: The function isdeploy goes to one and this code is executed

% Disable this property when deployed
if isdeployed, return, end

but net and err (the outputs) have no assigment yet.

So is this an error in the toolbox or instead what is the solution to the problem. The code I used for the execution of newff is:

S1=1;

TF1='tansig';

TF2='purelin';

net = newff(xe,ye,S1,{TF1 TF2});

where xe and ye are the inputs and objective functions and are correctly sized.

Thanks

Juan Isaza