MATLAB: Combining matrices

combiningforif

I'm trying to build a matrix with the number of occurences of a given condition from two matrices.
The objective is to now the number of points that correspond to a given statement and combining this into a m*n matrix to use on a plot
For example: how many waves have period<0.5 and height<1, how many waves have period<0.5 and 1<height<1.5. etc…
my class intervals are period=[0:1:17] and height=[0:0.5:10].
Is there a way to build a function that would in some way combine the two classes into a matrix that would help me build something like (I'm only interested in the numbers):
t=[period H] x=matrix size(t) %with the number of occurences of each class.
I tried using multiple for and if conditions and even simpler ways, but I'm feeling really lost.
Can someone help me?
thank you in advance
Paul

Best Answer

Basically, I want to do something like:
intervalHs=[0:0.5:10];
intervalTe=[0:1:20];
a=sum((Hs>0.5)&(Hs<1)&(Te<=1))
b=sum((Hs>2)&(Hs<=2.5)&(Te<=6)&(Te>5))
x=sum((Hs<=0.5)&(Te<=1))
y=sum((Hs<=0.5)&(Te>1)&(Te<=2))
z=sum((Hs<=0.5)&(Te>2)&(Te<=3))
and the construct a matrix (m*n) with the results