Not enough input arguments error MATLAB

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.
Capture.PNG

Antworten (5)

Nikesh Venkat
Nikesh Venkat am 10 Mär. 2019

0 Stimmen

I am new to MATLAB. I initially need to run the code, so can you please explain in brief.

1 Kommentar

Walter Roberson
Walter Roberson am 10 Mär. 2019
Why did you put those variables like shuffle and cv in to the function header when you wrote the function?

Melden Sie sich an, um zu kommentieren.

Nikesh Venkat
Nikesh Venkat am 10 Mär. 2019

0 Stimmen

I did not develope the code it was my professor’s she gave it me and asked to check for errors

1 Kommentar

Walter Roberson
Walter Roberson am 10 Mär. 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 ?

Melden Sie sich an, um zu kommentieren.

Nikesh Venkat
Nikesh Venkat am 10 Mär. 2019

0 Stimmen

I have attached the code file there is seperate libsvm folder in it.

17 Kommentare

Walter Roberson
Walter Roberson am 10 Mär. 2019
You should be running the script run_start_to_end
Nikesh Venkat
Nikesh Venkat am 19 Apr. 2019
Hi,
Can you please help me in solving one error in testing the sample data. Am getting two error while testing, can you please guide me.ROICorrelation.png
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.
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
Nikesh Venkat am 19 Apr. 2019
Ya I tried. but got different error in load.
Load.PNG
Nikesh Venkat
Nikesh Venkat am 19 Apr. 2019
I have attached the code and sample data in this can please look into it.
Where NYUData.zip is the sample data. HG_code is the code.
Walter Roberson
Walter Roberson am 19 Apr. 2019
Bearbeitet: Walter Roberson am 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
Nikesh Venkat am 19 Apr. 2019
Oh ok what was the default input data it is taking when we run the code?
Walter Roberson
Walter Roberson am 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
Nikesh Venkat am 19 Apr. 2019
So can’t we use ROISignal data to test because my professor said any one data should work in the code either ROICorrelation or ROISignal
Walter Roberson
Walter Roberson am 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
Nikesh Venkat am 20 Apr. 2019
Can you please do that for me, because am very new to matlab and I don't know anything about it please. I asked my profossor to convert the code to python but she asked me test the sample data then she can convert to python. So this is my only problem.
This what my professor said It contains data for you to test the code. I am not sure which data was used as input in the code. If it starts with correlation matrices, you can use ROICorrelation_XXXXXXX.mat (or .txt). If it gets original ROI-based intensities and computes the correlation matrices by itself, you can use ROISignal_XXXXXXX.mat (or .txt). Please double check the code before you choose either of the data
Walter Roberson
Walter Roberson am 20 Apr. 2019
I have no information as to which files are associated with which class.
Nikesh Venkat
Nikesh Venkat am 20 Apr. 2019
The main function is run_start_to_end which is compiling but we cannot run the remaining sub-programs because in run_start_to_end.m line 26, the code will call HG_start_to_end and And in HG_start_to_end in line 24, 26 and 28 call HG_construction, HG_learning and HG_Ranking.
Walter Roberson
Walter Roberson am 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
Nikesh Venkat am 20 Apr. 2019
There’s Readme file in the libsvm folder in code.
Walter Roberson
Walter Roberson am 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) ?

Melden Sie sich an, um zu kommentieren.

Nikesh Venkat
Nikesh Venkat am 10 Mär. 2019

0 Stimmen

yes I did because it is the main code but my professor said I should run the HG_run_start_to_end but there are errors in every script

5 Kommentare

Walter Roberson
Walter Roberson am 10 Mär. 2019
Please click on "Comment on this Answer" to reply, instead of using "Answer this question" each time.
Walter Roberson
Walter Roberson am 10 Mär. 2019
Are there error messages other than "Not enough input arguments" ?
Nikesh Venkat
Nikesh Venkat am 10 Mär. 2019
yes but not in run_start_to_end
Walter Roberson
Walter Roberson am 10 Mär. 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
Nikesh Venkat am 11 Mär. 2019
I will ask my professor clearly and wil let you know.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 10 Mär. 2019

Kommentiert:

am 13 Mai 2019

Community Treasure Hunt

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

Start Hunting!

Translated by