I have a two-dimensional matrix containing the index of the experimental condition in the first column, and the index of the corresponding experiment in the second column, i.e. [condition experiment]. Each line corresponds to one interesting event (one experiment can produce one or more events).
Counting conditions and events are easy. I would like to know how to calculate how many unique experiments there were for each given condition.
This is the solution that I have right now using ACCUMARRAY , but I think there should be a simpler or more elegant solution:
idxList = [1 1;... %
1 2;...
1 2;...
2 1;... %
2 1];
accumarray(idxList(:,1),idxList(:,2),[],@(x)length(unique(x)))
ans =
2
1