4

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!

Aquila
  • 65
  • 1
  • 7
  • I suggest an output using `graphconncomp` – Daniel Dec 11 '13 at 11:23
  • Thank you Daniel! A challenge though, this function is only available for Matlab2013b, and I have Matlab2013a. Can I install it as a separate toolbox? – Aquila Dec 11 '13 at 11:41
  • We need some constraints here...What should happen when there should be 24 connections to 1 string? Are all substrings 3 characters long? Do they all follow the pattern `[A-z][0-9][0-9]`? ... etc. – Rody Oldenhuis Dec 11 '13 at 11:42
  • All sub-strings are 3 characters long. E11E31 denotes the connection between an element E11 to an Element E31. The maximum no. of connections to an element is 3 times. Hence, for example, E81 can have at most 3 conections: E81E31, E81E41 and E81E51. They all follow the same pattern. – Aquila Dec 11 '13 at 11:46
  • Does it have to be text? How about a [schemaball](http://stackoverflow.com/questions/17038377/how-to-visualize-correlation-matrix-as-a-schemaball-in-matlab)? – Rody Oldenhuis Dec 11 '13 at 11:48
  • Thank you Rody, that's a good idea! Although, the results might become difficult to understand because I have a huge amount of lines that I want to analyse. I will try to build the correlation matrix and see how it looks. – Aquila Dec 11 '13 at 11:59
  • Can the connections follow circular topology? E.g., in your first example, can `E51` be connected back to `E11`? Your second example seems to imply that... – Rody Oldenhuis Dec 11 '13 at 12:47
  • I am not sure how to interpret your question, but here are extra details that could clear out the problem: a) each graph is "closed", so maybe you consider this circular; b) Particular elements can have 3 connections -> hence I can have loops; c) all connections are 1:1. – Aquila Dec 11 '13 at 13:24
  • I've implemented the schemaball approach but it make me lose to much time in interpreting the results. I will try also the graphconncomp recommended by @DanielR. If you have other suggestions I would be very happy to hear them! Thank you a lot for your help! ![One result][1] [1]: http://i.stack.imgur.com/uZ5ZM.jpg – Aquila Dec 11 '13 at 14:48

1 Answers1

0

An alternative to the already mentioned graphconncomp is gplot, but gplot has the issue that the nodes must be placed manually.

Let C be your connection matrix:

[x,y]=ind2sub([ceil(sqrt(size(C,1))),ceil(sqrt(size(C,1)))],1:numel(C))
gplot(C, [x' y'])

This plots all nodes on a regular grid, starting at the bottom left.

Daniel
  • 36,610
  • 3
  • 36
  • 69