optimize my matrix function
1 view (last 30 days)
Show older comments
Commented: danielle sisserman on 7 Nov 2020
this is my code:
knn_labels(t,1) = classifier.Ytrain(j,1);
t = t+1;
what I'm doing here is using a vector of indices to create a vector of the values at those indices using some other matrix:
But, I am sure that there is some pretty one liner that does this. Any one knows what that line looks like?
Walter Roberson on 7 Nov 2020
knn_labels = reshape( classifier.YTrain(k_indices), , 1);
More Answers (0)
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!