create vector with no repeated triplet sequences based on another vector
이전 댓글 표시
Hi,
I have a vector A=[1,2,3,4,5,6].
If we split this vector into triplets, with moving window of 1, we get these triplets: 123,234,345,456.
What I would like to do is create another vector B, using the exact same numbers that is in A. But I need to make sure that the triplet sequences in B are not present in A. So something like B=[6,2,5,4,3,1] because the triplets we get are: 625,254,543,431 which are not present in vector A.
Thanks!
답변 (1개)
Thorsten
2016년 8월 16일
Just reverse order:
B = fliplr(A);
댓글 수: 5
Yue Zhang
2016년 8월 16일
Thorsten
2016년 8월 16일
That's not possible, if I understood you correctly:
If you have 4 different numbers 1:4, you can generate 4*3*2=24 different triplets. If you have 120 numbers, you can generate 118 triplets. They cannot be all different.
Yue Zhang
2016년 8월 16일
Yue Zhang
2016년 8월 16일
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!