Easiest to implement is kmeans clustering. Look it up!
Matrix = % your 8191x300 matrix
NumC = 3 % number of clusters
idx = kmeans(Matrix,NumC)
idx will give you a vector of size 8191 containing the indices of each cluster(1,2 or 3) the row belongs to.