I have a character array (this can also be stored as a cell array if more useful) (list) and wish to tally the number of substring occurrences against two different indexes held in two separate variables type and ind.
list =
C C N N C U C N N N C N U N C N C
ind =
1 1 2 2 2 3 3 3 4 1 1 2 3 3 3 4 4
type =
15 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16
No spaces exist in the character array - added for clarity.
Using the above example, the desired output would tally all instances of unique letters in list, for each ind and for each type - creating three columns (for C/N/U), each with 4 rows (for each ind) - per type. This is done using the order in which the entries in each array appear.
Desired output of above example (the labels are added for clarity only):
Type 15 Type 16
Ind C N U C N U
1 2 0 0 1 1 0
2 1 2 0 0 1 0
3 1 1 1 1 1 1
4 0 1 0 1 1 0
I am only aware of how to do this with a single index (using unique, full and sparse).
How can I bet go about doing this with a dual index?

listalways contain only two letters?CandN:-)accumarrayseems to be the best approachcrosstab, seems to be the most appropriate for me.