How to compare strings in a cell-array and sort them?

1 view (last 30 days)
These are 2 cell-array, respectively list={'a','b','c','a','e','f','g'}; and list_short={'a','b','c','a'}; that contains the first four elements of 'list'.
I would like to compare the element in 'list_short' and if two of them are equals (like 'a'), change the first of them with the fifth in 'list' and shift the six and seven as five and six and the removed 'a' as seven.
The two cell-array will be: list={'a','b','c','a','f','g','a'}; and list_short={'e','b','c','a'};
Thanks in advance!

Answers (0)

Categories

Find more on Shifting and Sorting 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!