0
$\begingroup$

The result of my calculations is quite large list (nested list to be precise). I would like to improve its visualization, to make it more legible, by setting the number of columns to let's say 5. Documentation Center suggests an option AllowedDimensions, but it is new in ver 9. How can I make it happen in version 7? Thanks for any hints.

Edit: The list has two sublists of equal length, simple example would be:

list={{45.1,73.5,12.9,56.4,114.6,87.1,90.5,263.8,99.3,104.6},
     {0.34,0.12,0.56,0.95,0.25,0.57,1.03,0.73,0.92,1.02}};

Edit 1: After setting the number of columns to 5 it should look more or less like this:

{{45.1,73.5,12.9,56.4,114.6,
  87.1,90.5,263.8,99.3,104.6},
 {0.34,0.12,0.56,0.95,0.25,
  0.57,1.03,0.73,0.92,1.02}};
$\endgroup$
4
  • $\begingroup$ We need more details from you but in the absence of any clarifying information If you have some data, nested or otherwise, and you want to present it as 5 columns then have a look at Flatten and Partition. The nesting may mean it is not as straight forward as that but until you post an example that is all I can suggest. $\endgroup$ Feb 10, 2014 at 9:31
  • $\begingroup$ For some reasons I would like the list to stay nested, so I'd like to avoid Flatten. $\endgroup$
    – Wojciech
    Feb 10, 2014 at 9:41
  • $\begingroup$ Can you post an example of the nested data and an example of how that nested data should look when transformed into 5 columns. $\endgroup$ Feb 10, 2014 at 22:22
  • $\begingroup$ @MikeHoneychurch done $\endgroup$
    – Wojciech
    Feb 11, 2014 at 8:44

1 Answer 1

0
$\begingroup$

I feel like I'm the only one still using ver 7... However, if by any chance someone is as stubborn as me and also uses ver 7, I found a way to solve this problem. At least it works for me.

It is PageWidth option that helps here. I followed the Basic Examples in Documentation Center and came up with the following code:

file1 = $TemporaryPrefix <> "test1";
list = {{45.1, 73.5, 12.9, 56.4, 114.6, 87.1, 90.5, 263.8, 99.3,104.6}, 
        {0.34, 0.12, 0.56, 0.95, 0.25, 0.57, 1.03, 0.73, 0.92,1.02}};
stream = OpenWrite[file1, PageWidth -> 35];
Write[stream, list];
Close[stream];
FilePrint[file1]

PageWidth->n specifies that each line of the stream should be wide for n characters, after some calculations I was able to determine this value to be around 35 in my case and the result was pretty much what I wanted:

{{45.1, 73.5, 12.9, 56.4, 114.6,

87.1, 90.5, 263.8, 99.3, 104.6},

{0.34, 0.12, 0.56, 0.95, 0.25,

0.57, 1.03, 0.73, 0.92, 1.02}}

I believe that list can be created not only explicitly like here, but any other way for example using Table.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.