Not enough input arguments error MATLAB
Show older comments
When I am trying to run the source code am getting an error called not enough input arguments. What might be the error for this. I have also attached image of it.

1 Comment
Rena Berman
on 13 May 2019
(Answers dev) Restored deleted content.
Answers (5)
Nikesh Venkat
on 10 Mar 2019
0 votes
1 Comment
Walter Roberson
on 10 Mar 2019
Why did you put those variables like shuffle and cv in to the function header when you wrote the function?
Nikesh Venkat
on 10 Mar 2019
0 votes
1 Comment
Walter Roberson
on 10 Mar 2019
The code assigns the same values to idx_train and idx_test which is likely to be wrong.
The code needs documentation about its purpose and any assumptions about the input.
Is there a particular reason you are not using MATLAB's own svm instead of external SVM ?
Nikesh Venkat
on 10 Mar 2019
0 votes
17 Comments
Walter Roberson
on 10 Mar 2019
You should be running the script run_start_to_end
Nikesh Venkat
on 19 Apr 2019
Walter Roberson
on 19 Apr 2019
indices is probably intended to be in the file you load() .
If you do have a variable named indices in your ROISignals_0050959.mat, then just before your load() call, put in the statement
indices = [];
That will tell MATLAB that indices is the name of a variable that might get overwritten by the load() call. Newer versions of MATLAB assume that no variables are "poofed" into existence by load() calls, but existing variables are permitted to be change by load() calls.
Walter Roberson
on 19 Apr 2019
Also it appears that your code also expects a variable named data to be loaded from the file. Be sure to add
data = [];
before the load().
You should also use
whos -file e:\temp\NYUData\ROISignals_0050959.mat
to check to be sure that there are variables named data and indices stored in that file.
Nikesh Venkat
on 19 Apr 2019
Nikesh Venkat
on 19 Apr 2019
Walter Roberson
on 19 Apr 2019
Edited: Walter Roberson
on 19 Apr 2019
You cannot load from inside a .zip file. You need to unzip the file.
That ROICorrelations_0050952.mat file does not contain a variable named data or a variable named indices : it contains a variable named ROICorrelation which is just a 3 x 3 double. The ROISignals_0050952.mat file contains a variable named ROISignals that is 170 x 3 double.
I do not see anything in those files that might act like the "indices" variable. The indices variable, indexed at the "shuffle" column, is expected to be a class number; your data does not look like that at all.
Nikesh Venkat
on 19 Apr 2019
Walter Roberson
on 19 Apr 2019
There is no default input data.
The run_start_to_end function creates demo_part.m with variables data, indices, and gnd (which I see now is also needed by the code.)
data appears to be the signals.
gnd appears to be class indicators.
indices appears to be used to store cross-validation indices.
Nikesh Venkat
on 19 Apr 2019
Walter Roberson
on 19 Apr 2019
It looks to me as if what you would need would be a class indicator ("ground truth") for a number of differnet ROI* files. You would create a variable "gnd" that listed the class indicator. You would load the data files into a cell array named data, in the same order as the indicators applicable in "gnd", so for example data{4} would contain content that was class indicated by gnd(4) . The data stored in each cell would be the complete contents of one of the files -- so for example data{4} might have the complete contents of the data from ROISignals_0051063 and data{5} might have the complete contents fomr ROISignals_0050967
Once you had those two varialbes, you could use crossvalind() to create cross-validation indices that you would store into the variable indices .
Once you had those three variables all together, data cell, gnd vector of class indicators, and indices 2d array of cross-validation indices, you would save them in a .mat, and you would load that .mat in HG_start_to_end . You do not load individual ROI* files there.
Nikesh Venkat
on 20 Apr 2019
Walter Roberson
on 20 Apr 2019
I have no information as to which files are associated with which class.
Nikesh Venkat
on 20 Apr 2019
Walter Roberson
on 20 Apr 2019
That does not tell me which files belong to what class. You need at least two different classes of data to use this code.
Nikesh Venkat
on 20 Apr 2019
Walter Roberson
on 25 Apr 2019
The README in the libsvm folder HG_code/hg_code/libsvm just gives installation instructions for libsvm . It does not give me any information about whether ROISignals_0050960.mat is associated with class 2, and ROISignals_0051067.mat is associated with class 1. For example should we assume that all of the _0050xxx files are one class (48 members) and that all of the _0051xxx files are a different class (1160 members) ?
Nikesh Venkat
on 10 Mar 2019
0 votes
5 Comments
Walter Roberson
on 10 Mar 2019
Please click on "Comment on this Answer" to reply, instead of using "Answer this question" each time.
Walter Roberson
on 10 Mar 2019
Are there error messages other than "Not enough input arguments" ?
Nikesh Venkat
on 10 Mar 2019
Walter Roberson
on 10 Mar 2019
We need to know how you are invoking HG_run_start_to_end now. We need copies of the error messages.
In order to give you the best advice it would help if you could explain why you are using libsvm instead of MATLAB's svm routines.
Nikesh Venkat
on 11 Mar 2019
Categories
Find more on Call Python from MATLAB 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!
