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 view (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 12 Oct 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

Categories

Find more on Entering Commands 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!