How to extract the all combinations of array (permutations combinations)
Show older comments
Hi,
I have a matrix as below:
A Success
B Failure
C Success
A Success
B Success
C Success
I want to count how many time B appeared after A or A appeared after A or C appeared after B (for example: i-1 should be A, and i should B: so it counted as AB). The resultant combinations are as shown below: So, again I want to count how many time A appeared after A, B appeared after A, B appeared after B, C appeared after B (or C,or A,or D)etc.
AA AB AC
BA BB BC
CA CB CC
My out put should be: Out_sucess (only succeefull combinations):
0 1 0
0 0 2
1 0 0
Out_Fail(Failed combinations):
0 1 0
0 0 0
0 0 0
Kindly help how do I get these out puts
4 Comments
dpb
on 13 Aug 2015
Going to have to give more specifics on how you come up with the decision (definition of "success"). You have 'AA' as 0 but there are combination of entries that match; same for 'AC'. You also have 0 for the same combination of both success and fail--that's not consistent it would seem.
James Tursa
on 14 Aug 2015
How is your original matrix stored? As a vector of characters?
the cyclist
on 14 Aug 2015
Edited: the cyclist
on 14 Aug 2015
@dpb, I think he/she is only looking at "nearest neighbor" pairs, and basing the classification on the success/failure of the 2nd member of the pair. (At least, this gives the quoted result.)
Kanakaiah Jakkula
on 15 Aug 2015
Accepted Answer
More Answers (0)
Categories
Find more on Lengths and Angles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!