I am getting error as " Too many input arguments" . i am trying develop a neural network based model .

??? Error using ==> TS1>feed_forward_signals
Too many input arguments.
Error in ==> TS1>Run_Neural_Net_Regression at 144
feed_forward_signals(hidden_input_wts,input,hidden,hidden_bias,25,8,0)
Error in ==> TS1 at 100
Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,...
Error in ==> Neural_network>Calculate_Callback at 1162
data = TS1();
Code
scale_inputs(input,0,1,25,max_input,min_input);
Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,...
output,output_bias);
unscale_targets(output,0,1,1,max_target,min_target);
% handles.TS=output(1);
% guidata(hObject, handles)
data.TS = 300;
% setappdata(fig_handle, 'metricdata', data);
% set(handles.TS, 'String', data.TS);
x=100;
function scale_inputs(input,minimum,maximum,size,max_input,min_input)
for i = 1:size
delta = (maximum-minimum)/(max_input(i)- min_input(i));
input(i) = minimum - delta*min_input(i)+ delta*input(i);
end
end
function unscale_targets(output,minimum,maximum,size,max_target,min_target)
for i = 1:size
delta = (maximum-minimum)/(max_target(i)-min_target(i));
output(i) = (output(i) - minimum + delta*min_target(i))/delta;
end
end
function feed_forward_signals(MAT_INOUT,V_IN,V_OUT,V_BIAS,size1,size2) %%%,layer)
for row = 1:size2
V_OUT(row)=0;
for col = 1:size1
V_OUT(row)=V_OUT(row)+MAT_INOUT(row,col)*V_IN(col);
end
V_OUT(row)=V_OUT(row)+V_BIAS(row);
%if layer==0
% V_OUT(row) = exp(V_OUT(row));
%end
% if layer==1
% V_OUT(row) = exp(V_OUT(row));
% end
end
end
function Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,...
output,output_bias)
feed_forward_signals(hidden_input_wts,input,hidden,hidden_bias,25,8,0)
feed_forward_signals(hidden_output_wts,hidden,output,output_bias,8,1,1)
end
end

 Accepted Answer

This is just a basic case of reading what the error message tells you. Even in the unformatted form you posted it it is easy to see the function takes 6 arguments and you have passed in 7.
Error messages are there to be helpful rather than just a splash of red telling you "something is wrong"!

6 Comments

i am new in this field. please tell me how can i pass 7 or more arguments.
If you want to pass in more arguments then where you declare the function you have to add the new argument to the list.
Looking at your code though that 7th argument appears to be there but commented out so assuming it is the same argument you are trying to pass in, just remove the ') %%%' from in front of 'layer' in your function definition to become:
function feed_forward_signals( MAT_INOUT, V_IN, V_OUT, V_BIAS, size1, size2, layer )
(I also added some spaces as I can never understand why so many people refuse to put white space in amongst their code to improve readability!)
Thanks for your reply. I have added the 7th argument and after adding this, I'm getting another error, which is given below
Error
??? Attempted to access MAT_INOUT(2,1); index out of bounds because size(MAT_INOUT)=[1,200].
Error in ==> TS1>feed_forward_signals at 131
V_OUT(row)=V_OUT(row)+MAT_INOUT(row,col)*V_IN(col);
Error in ==> TS1>Run_Neural_Net_Regression at 147
feed_forward_signals(hidden_input_wts,input,hidden,hidden_bias,25,8,0)
Error in ==> TS1 at 100
Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,...
Error in ==> Neural_network>Calculate_Callback at 1162
data = TS1();
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Neural_network at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback
What are you passing in as size2? Also why are you passing in size1 and size2 when it appears they just need to be the row and column sizes of MAT_INOUT?
You would be better just using:
size( MAT_INOUT )
inside your function to ensure the result always matches your matrix.
i have changed the code as you told . but still getting error as "Too many input arguments". i am putting here error and code and attaching the file with full code.
??? Error using ==> TS1>feed_forward_signals Too many input arguments.
Error in ==> TS1>Run_Neural_Net_Regression at 147 feed_forward_signals(hidden_input_wts,input,hidden,hidden_bias,25,8,0)
Error in ==> TS1 at 100 Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,...
Error in ==> Neural_network>Calculate_Callback at 1162 data = TS1();
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> Neural_network at 42 gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback
Code function Run_Neural_Net_Regression(hidden_input_wts,input,hidden,hidden_bias,hidden_output_wts,... output,output_bias)
feed_forward_signals(hidden_input_wts,input,hidden,hidden_bias,25,8,0)
Well, if you changed the code as I suggested you should no longer have the two size arguments passed in so the 25 and 8 I think should no longer be there assuming they are the size arguments.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 29 Oct 2014

Commented:

on 2 Nov 2014

Community Treasure Hunt

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

Start Hunting!