How to order and print string cells content by the match within the individual strings, Matlab?

Viewed 106

I want to print the content of a cell line such that matching strings are one after another. The original line looks like:

Example 1:

'E11E81'    'E21E81'    'E31E51'    'E31E61'    'E61E81'

From this line, I would like to print:

E11 - E81 - E61 - E31 - E51
       |
      E21

Example 2:

'E11E81'    'E21E82'    'E31E81'    'E31E83'    'E51E83'    'E61E82'    'E61E83'    'E81E82'

From this line, I would like to print:

E11 -  E81 - E31 - E83 - E5   
        |           |
 E21 - E82 - E61  - 

So far, for each cell position I use

b = strncmp('E11E81',current_connection,6);
if  b == 1, disp('E1 - E81 - '); end

but I don't know how to go further.

Any ideas? Thank you for your thoughts!

1 Answers
Related