change "iCurrentClass = randperm(length(iCurrentClass));" (line 33) by "iCurrentClass = iCurrentClass(randperm(length(iCurrentClass)))';"
The generated folds were being generated only in one half of the labels, and so, the testing process, when applying svm_rbf for example, were being tested in one half, i.e. when the labels_train are 16, the generated folds have only from 1 to 8, and so, the testing process were done only with those but not over the others (9-16).
change "iCurrentClass = randperm(length(iCurrentClass));" (line 33) by "iCurrentClass = iCurrentClass(randperm(length(iCurrentClass)))';" The generated folds were being generated only in one half of the labels, and so, the testing process, when applying svm_rbf for example, were being tested in one half, i.e. when the labels_train are 16, the generated folds have only from 1 to 8, and so, the testing process were done only with those but not over the others (9-16).