Two questions about "hist" function

I have two questions about "hist". As you know, [n,xout] = hist(...) returns vectors n and xout containing the frequency counts and the bin locations.

a = [7 3 8 4 2 6 9 4 3];

[n,x] = hist(a,2);

Result:

n =

5 4

x =

3.7500 7.2500

1. How can I obtain the elements (or indexes of elements) which exist in the first interval or second interval? For instance, at the above example for first interval the elements {2,3,3,4,4} and for second interval the elements {6,7,8,9}.

2. How can I use the hist function when I have a Three dimensional vector (a matrix(3*3)) instead of a single dimensional vector?