MATLAB Answers

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)
Sivabharathi K
Sivabharathi K on 12 Oct 2019
Commented: Stephen Cobeldick on 12 Oct 2019
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;


Sign in to comment.

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';

Sign in to answer this question.