If you check (http://www.mathworks.com/help/bioinfo/ref/knnclassify.html) knnclassify documentation, it mentions samples and training as matrixes/matrices. Cell won't work.
I have applied kNN classifier to a nominal classes, where the features/attributes were numeric. I have used WEKA software to perform the classification task.
In my point of view, I think you need to transform your features/attributes from nominal to binary.
I am not sure what you mean when you say that it failed. It would be easier to help if you reported, at least, the error message that Matlab gave you. What I can say is that Farzaneh is right, in fact, Test_data and Train_data cannot be cell, these should be matrices. Train_Observation can be cell (see http://www.mathworks.it/it/help/bioinfo/ref/knnclassify.html). I am also not sure what you mean with classifying nominal data. Which of the variables input to the function is nominal in your case? Test_data and Train_data must be numeric - with same number of columns. Train_Observation can be nominal - with same number of rows as Train_data. Hope this helps a bit, Costanzo
One approach is binarization of nominal attributes and it has already been discussed.
But, if you use kNN distance measure (metrics) appropriate for nominal data, you can use original data with nominal attribute values without any changes. This measure can be, for example, "Hamming" distance ("percentage of coordinates that differ" in Matlab) or some custom semi-metric distance function.
If you can use Weka kNN methods, they already allow using any combination of numeral and nominal attribute types for Euclidean and several other distance measures.
You can use the same approach for clustering methods.
Ahmed.... implementing a knn classifier is easy. I think it would not be a difficult thing for you to program it in any language. What i recommend to you in the case of nominal data, is the distance function. Hamming distance have some drawbacks in the sense that it treats matches and mismatches equal, which in some cases is not true.
Another possibility is to use categorical distance measures (see e.g. Boriah et al. https://www.researchgate.net/publication/220907006_Similarity_Measures_for_Categorical_Data_A_Comparative_Evaluation) in your knn algorithm. Furthermore, you can also apply knn on mixed attribute datasets by using a categorical distance measure on categorical attributes and a numerical distance measure on numerical data. Afterwards you combine them (as e.g. described in http://charuaggarwal.net/outlierbook.pdf).