MATLAB: Counting occurrences of each column in a matrix

arraycolumnscountMATLABmatrixrowsvector

I have a matrix with 16 columns and a very large number of rows. Each column has two possible outcomes in it (for example 1 or 0 in one column, .6 and .4 in another). I would like to count each of these occurrences in the columns. Preferably, I'd like to have a vector that counts each outcome of its respective column. Thank you!
[EDITED, Jan, moved from section for answers]
Example: A = [1 .6 .7 .8; 0 .4 .3 .2; 1 .6 .7 .8; 1 .6 .3 .8]
ans = [3 3 2 2 ; 1 1 2 2]

Best Answer

Since you have not given any sample data, I am taking some random data.
A=randi(50,50,50);
A(A<=25)=0.4;
A(A>25)=0.6;
A contains only 0.4 and 0.6 only, spreaded out completely. The below program gives you the occurrence of 0.4 and 0.6 in every coloumn.
nums1=arrayfun(@(x) length(find(A(:,x)==0.4)),1:size(A,2));
nums2=arrayfun(@(x) length(find(A(:,x)==0.6)),1:size(A,2));
occur=[nums1' nums2'];
nums2 can also be calculated as
nums2=size(A,1)-nums1;