I have 2 matrices, W and Y. Using both as references, I want to list the different combinations and count how many times it appears from Y. Only count Y if the correponsing W value is >0.
W =[ 25 0 0 28 0 0 25 0 0 25 0 0 15 14 0 0 25 0 0]; Y =[ 1 2 0 0 1 3 2 0 1 4 3 2 1 3 0 0 1 2 3 0 1 4 3 0 1 4 0 0 1 3 4 0 1 2 3 4 2 3 0 0 2 1 3 0 2 1 4 3 2 1 4 0 2 3 4 0 2 1 3 4 2 3 1 4 3 4 0 0 3 1 4 0 3 2 1 4]; Zlist =[12;13;14;23;24;34;]
Add 2 1 to 1 2; 3 1 to 1 3; 4 1 to 1 4; 3 2 to 2 3; 4 3 to 3 4 and 4 2 to 24
Also, for Y with more > 2 numbers in the row like [2 1 4], it will have a combinations of 2 1, 1 4, 2 4 while [2 3 4] has 2 3, 3 4 and 2 4.
Zlistcount =[2;1;2;2;2;2;]
Best Answer