Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Analytically identify groups in a vector and bin accordingly
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Background: I am doing image analysis on laser lines, and I currently have a series of vectors representing the brightness of each pixel in a column, which, since I have three lines, is a trimodal distribution. I set a threshold based on the maximum brightness and added the indexes of points over the threshold to a new array, which will look something like the following:
ind = [100 101 102 103 191 192 194 195 196 251 252 253]
Upon inspection, there are three separate groupings of numbers here (100-103, 191-196, 251-253), although I can't use just look for breaks in consecutive numbers, because pixel 193 of my original vector was below the threshold.
My goal is to split this vector of indexes into three different vectors: [100 101 102 103], [191 192 194 195 196], [251 252 253]
Is there a function/algorithm I can use to identify significant gaps in vectors and bin into a specified number (in this case, three) of vectors?
Thanks,
Alex H
0 commentaires
Réponses (1)
Star Strider
le 18 Sep 2015
I’m not certain I understand exactly what you want, but I would use one of the histogram functions, perhaps histc, since it can also provide the indices of the elements in the original data vector that comprised each bin.
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!