MATLAB Answers

0

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

Asked by Sivabharathi K on 12 Oct 2019 at 16:07
Latest activity Commented on by Stephen Cobeldick on 12 Oct 2019 at 16:21
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 12 Oct 2019 at 16:15

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