How to define edges in hist3 function

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:
dD=(0:0.01:0.25);
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!

댓글 수: 5

help says that edges is a two-element cell array of numeric vectors with monotonically non-decreasing values,
In your code you wrote it as a vector, try {diam dD}'
Marin
Marin 2012년 7월 9일
Oh, yes, that solves it. Thank you.
I wasn't sure about the difference between an array and vector. So if I understood it correctly an array is defined by {}, while a vector is defined by []. Is that the only difference?
Oleg Komarov
Oleg Komarov 2012년 7월 9일
편집: Oleg Komarov 2012년 7월 9일
A cell array is accessed with {}.
The [] are the horizontal concatenation operator.
Marin
Marin 2012년 7월 9일
Oh, ok, that makes things a bit clearer. Thank you!
Chris
Chris 2015년 1월 31일
Thank you!

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

답변 (0개)

카테고리

질문:

2012년 7월 7일

댓글:

2015년 1월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by