Group Abstract Group Abstract

Message Boards Message Boards

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

Empty lines in exported file

Posted 10 years ago

I am producing a file using the following code:

finalOutput = 
  Transpose[{Drop[profilelength, 1]}~Join~
    Riffle[OPTIMUMTOP/100, OPTIMUMBTM/100]];
Export["results_\
output.txt", ToString[TableForm@finalOutput]];
SystemOpen["results_\
output.txt"]

Please note that TableForm[finalOutput] returns the table exactly as I want it to be!

However the code above returns a file with every second line completely empty. No data is missing it just has twice as much lines ad necessary. Is there a way to delete them? (see attached output file).

Attachments:
POSTED BY: Mitja Jan?i?
2 Replies

Works really nice! Thank you!

POSTED BY: Mitja Jan?i?

TableForm is meant to nice visual ascii output. This is why it inserts blank lines. You can delete the extra empty lines with StringReplace:

StringReplace[ToString[TableForm[{{1, 2}, {3, 4}}]], "\n\n" -> "\n"]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard