Not enough input arguments in function called

1 view (last 30 days)
Hello
My Code while running gives a basic error while calling the function.
Not enough input arguments.
Error in function (line 45) (very last line of my post)
train_data=load(TrainingData_File); test_data=load(TestingData_File);
I have tried my best to compare the arguments but it is not working out. Can anyone please check the code. I am attaching the data file and the inbuilt function that is being called. That being said as I am stuck I can't proceed to the next stages.
Thanks very very much in advance for your time and effort
Eva
data file code which calls the function
data_len= length(data)
train_length = round(data_len/2);
RawData=data;
nn=size(RawData,2);
for index=1:nn
NormData(:,index)=(RawData(:,index)-min(RawData(:,index)))./(max(RawData(:,index))-min(RawData(:,index)));
end
%%
%Preparing training data
Trn_inputn=NormData(1:train_length,1:nn-1);
Trn_outputn=NormData(1:train_length,nn);
Chk_inputn=NormData(train_length+1:end,1:nn-1); Chk_outputn=NormData(train_length+1:end,nn);
TrainingData_File =[Trn_outputn Trn_inputn];
TestingData_File = [Chk_outputn Chk_inputn];
%%
mean_training=mean(TrainingData_File)
mean_test=mean(TestingData_File)
std_training=std(TrainingData_File)
std_test=std(TestingData_File)
var_training=var(TrainingData_File)
var_test=var(TestingData_File)
%explanatory_var=[]
explanatory_var= [mean_training; mean_test; std_training; std_test; var_training; var_test]
%%
THE FUNCTION CALLED IS
function [TrainingTime, TestingTime, TrainingAccuracy, TestingAccuracy] = OSELM(TrainingData_File, TestingData_File, Elm_Type, nHiddenNeurons, ActivationFunction, N0, Block)
REGRESSION=0;
CLASSIFICATION=1;
%%%%%%%%%%% Load dataset. FOLLOWING IS LINE 45
train_data=load(TrainingData_File); test_data=load(TestingData_File);
  2 Comments
Rik
Rik on 27 Nov 2018
Where are you calling the OSELM function? I suspect you forgot to enter the input arguments there.
Walter Roberson
Walter Roberson on 27 Nov 2018
it is confusing that TrainingData_File is intended to be character when used in the function but is numeric in the script .
also we do not know the filenames so we do not know if load() is returning numeric or struct . Numeric is implied in context which would require reading from aa text file; it is usually clearer to code one of the routines that deals with text files rather than the ambiguous load()

Sign in to comment.

Answers (0)

Categories

Find more on Testing Frameworks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!