Message Boards Message Boards

0
|
4136 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Formated associations export

Posted 3 years ago

Hello,

I have a list (of associations) in the following format

A={
    {0.961583, 0.623248, 0.7629, 5.43381, 0.} -> {0.623248, 5.43381}
    {0.961583, 0.623248, 0.7629, 5.43381, 4.95} -> {3.87293, 7.06457}
...
}

I would like to export this list to a file (txt file) in the following format:

0.961583  0.623248  0.7629  5.43381, 0.    0.623248  5.43381
0.961583  0.623248  0.7629  5.43381  4.95  3.87293   7.06457
...

(Doesn't have to be alligned, though)

I looked at ExportString, StringForm, Export, Flatten functions, but to no avail. I appriciate your help greatly.

Thank you

POSTED BY: Yeso Alde
2 Replies
Posted 3 years ago

Thank you very much.

POSTED BY: Updating Name
Posted 3 years ago

Hi Yeso,

Here is one way to do it

a = {{0.961583, 0.623248, 0.7629, 5.43381, 0.} -> {0.623248, 5.43381},
     {0.961583, 0.623248, 0.7629, 5.43381, 4.95} -> {3.87293,7.06457}};

lists = First@#~Join~Last@# & /@ a

Export["lists.txt", lists, "Table", "FieldSeparators" -> " "]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract