Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Analytically identify groups in a vector and bin accordingly

1 Ansicht (letzte 30 Tage)
Alex H
Alex H am 18 Sep. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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

Antworten (1)

Star Strider
Star Strider am 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.

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by