Assuming that the known classes are stored in a vector called known_classes and the predicted classes are stored in a vector called predicted_classes, the following code can be used to compare the two vectors and store the result in a variable called iscorrect:
iscorrect = (known_classes == predicted_classes);
The variable iscorrect will be a logical vector with the same length as the vectors known_classes and predicted_classes. Each element of the vector will be true if the prediction matches the known class, and false otherwise.
gistlibby LogSnag