unique vector with restrictions
Show older comments
Say I have these vector:
head_1=[1 6];
body_1=[1 4 5 6 8 9 15];
head_2=[7 9 13];
body_2=[5 7 8 9 13 20 30];
head_3=[20 30];
body_3=[4 5 8 11 19 20 30 40 50 100];
A vector head is a subset of vector body. Now I would like to have a collection of all the head vectors, but if a vector head_x is fully in vector body_y, then take head_y instead. If vector head_x is partially in vector body_y, then take head_y instead plus the other elements of head_x. So in my example, the collection would be:
head_final=[7 13 1 6];
In reality I can have several head and body vectors. Any hint will be apprecaitted!
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!