I am trying to learn relevant features in a 300*299 training matrix by taking a random row from it as my test data and applying sequentialfs on it. I have used the following code:>> Md1=fitcdiscr(xtrain,ytrain);>> func = @(xtrain, ytrain, xtest, ytest) sum(ytest ~= predict(Md1,xtest));>> learnt = sequentialfs(func,xtrain,ytrain)xtrain and ytrain are 299*299 and 299*1 respectively. Predict will give me the predicted label for xtest(which is some random row from original xtrain).However, when I run my code, I get the following error:Error using crossval>evalFun (line 480)The function '@(xtrain,ytrain,xtest,ytest)sum(ytest~=predict(Md1,xtest))' generated the following error:X must have 299 columns.Error in crossval>getFuncVal (line 497)funResult = evalFun(funorStr,arg(:));Error in crossval (line 343)    funResult = getFuncVal(1, nData, cvp, data, funorStr, []);Error in sequentialfs>callfun (line 485)    funResult = crossval(fun,x,other_data{:},...Error in sequentialfs (line 353)                crit(k) = callfun(fun,x,other_data,cv,mcreps,ParOptions);Error in new (line 13)    learnt = sequentialfs(func,xtrain,ytrain)Where did I go wrong?
Matlab feature selection
machine learning;feature selection;matlab