Hai .. i am new to matlab.. i have trouble in below function.. i am trying to run the below code but i got error 'not enough input arguments' .. please help me solve it... Thanks

1 Ansicht (letzte 30 Tage)
function [ trainClass ] = buildClassLabel(name)
% defining the labels of the clusters
if contains(name, 'handclapping')
trainClass = 2;
elseif contains(name,'boxing')
trainClass = 1;
elseif contains(name,'handwaving')
trainClass = 3;
elseif contains(name,'running')
trainClass = 5;
elseif contains(name,'jogging')
trainClass = 4;
elseif contains(name,'walking')
trainClass = 6;
end
end

Antworten (1)

Image Analyst
Image Analyst am 12 Okt. 2019
What is name when you call it? For example did you do this
[ trainClass ] = buildClassLabel('Siva');
which should work. Or did you simply press the green run triangle and run it, which will not have anything for name and thus give you the error? Have this as the first code in the function:
if isempty(name)
message = 'You must supply something for the name input variable';
uiwait(errordlg(message))
return;
end

Kategorien

Mehr zu Entering Commands finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by