MATLAB: How to use a table column in a IF statement correctly

if statementtable column

'test' is a table below and I want to use the 14th column in 'test' to compare to the 'Predict_label'. i am getting this error: Undefined operator '==' for input arguments of type 'table'. **** ****
z = height(test);
Predict_label=trainedSVMmedGauss.predictFcn(test);
correct_response_med_gauss=0;
wrong_response_med_gauss=0;
i=0;
for i=1:z
if (Predict_label(i,:)==test(i,14))
correct_response_med_gauss=correct_response_med_gauss_SVM+1;
else wrong_response_med_gauss=wrong_response_med_gauss_SVM+1;
end;
end;

Best Answer

When you use () to index a table you get back a table, just like when you use () to index a cell array you get back a cell array. The solution is to use {} indexing
Related Question