You can compare
predictedclassindices = vec2ind(output)
with
trueclassindices = vec2ind(target)
For examples search
greg patternnet vec2ind
or, use the confusion function
help confusion
doc confusion
Hope this helps.
Thank you for formally accepting my answer
Greg