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

For questions and discussion related to reading in and working with data.
jonasdovern
Posts: 97
Joined: Sat Apr 11, 2009 10:30 am

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

Unread post by jonasdovern »

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?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

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.
Post Reply