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

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 :)

 채택된 답변

Image Analyst
Image Analyst 2018년 2월 17일
편집: Image Analyst 2018년 2월 17일
Use masking:
goodIndexes = particles >= 2;
histogram(particles(goodIndexes), 20);
particles is your data array.

댓글 수: 3

Undefined operator '>=' for input arguments of
type 'cell'.
Well then use whatever array has your data in it:
yourData = yourData >= 2;
histogram(particles(yourData), 20);
yourData would be a numerical array, like double or int32, not a cell array. http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
Extract yourData from the cell array if you have to. Maybe that's what lc is, so maybe you can use lc. I don't know what lc is - that's why I always use descriptive variable names.
Sorry, lc is cumulative length but I didn't explain and it worked the second time I used it for some reason! Thank you for your help :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

태그

질문:

2018년 2월 17일

댓글:

2018년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by