MATLAB Answers

How to define edges in hist3 function

16 views (last 30 days)
Marin on 7 Jul 2012
Commented: Chris on 31 Jan 2015
Hi, so I have some 2D data and I would like to make a histogram, I've seen that I can do that with hist3 function, but I would like to define edges for the bins, not just divide the data range into n bins of the same size. So I've made this code:
diam=[1 2 3 4 5 10 15 20 30 40 50];
z=hist3([krateri_br(:,3) krateri_br(:,4)],'Edges',[diam dD]');
But every time I get an error:
??? Error using ==> hist3 at 132 Bin edges must be specified with a cell array containing two numeric vectors.__
Now, I've tried different combinations of parenthesis for edges vector, but nothing seems to work. I have a feeling that I'm making some elementary mistake, but cannot find it, so if someone knows how to solve this, please help.
Thank you in advance!


Show 2 older comments
Oleg Komarov
Oleg Komarov on 9 Jul 2012
A cell array is accessed with {}.
The [] are the horizontal concatenation operator.
Marin on 9 Jul 2012
Oh, ok, that makes things a bit clearer. Thank you!

Sign in to comment.

Answers (0)

Sign in to answer this question.