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

1 次查看(过去 30 天)
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!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by