MATLAB: Histogram struggles (excluding low values and multiplying all the data)

histogram

Hi,
Iā€™m trying to make histogram out of some data
lc = cellfun(@(c) c(end,6),particles);
hist(lc, 20)
How do I exclude values lower than 2 from the histogram? (as this back ground noise and looks messy)
ALSO – the data is current in the wrong units and I would convert it by multiplying by 7.431 (for example)
So to apply this to the data in the histogram would I do:
lc = cellfun(@(c) c(end,6),particles)
f=lc*7.431
hist(f,20)
Thanks in advance šŸ™‚

Best Answer

Use masking:
goodIndexes = particles >= 2;
histogram(particles(goodIndexes), 20);
particles is your data array.