How to avoid line breaks when writing a matrix to a file?

For questions and discussion related to reading in and working with data.

How to avoid line breaks when writing a matrix to a file?

Postby jonasdovern » Fri Feb 22, 2013 7:47 am

When using the following code to write a large matrix to a text file, I have the problem that RATS makes several line breaks for each row of the matrix. (Similar to what RATS also does when displaying a large array in the output file on the screen.)

Code: Select all
decl rec G
comp G = %zeros(200,200)
open copy Gmat.txt
    display(unit=copy) G
close copy

Is there any way to avoid these line breaks?
jonasdovern
 
Posts: 68
Joined: Sat Apr 11, 2009 10:30 am

Re: How to avoid line breaks when writing a matrix to a file

Postby TomDoan » Fri Feb 22, 2013 4:14 pm

Try

write(unit=copy,format=prn) g

Use a PICTURE clause if you want it to line up better.

DISPLAY is really designed to put output to the screen, so 2000 character lines aren't permitted.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm


Return to Data: Reading, Writing, Transforming

Who is online

Users browsing this forum: No registered users and 0 guests

cron