formatting a text file for display by other applications

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

formatting a text file for display by other applications

Postby Stu on Wed Apr 11, 2018 7:54 pm

I'm trying to write a flat text file to be displayed in 3D by GNUplot, but I can't seem to get the various pieces I need to do this to work. I start with three arrays of integers, x, y, and z, and then format them into a columnar arrangement with

⍕⍉(3,×/⍴M)⍴x,y,z

The result displays correctly and has ⎕DR 80. PutText doesn't like this even though the documentation says it requires 8-bit data. If I could get PutText to work, I might still have a problem because GNUplot expects Unicode text files. I need some advice on how to solve this.
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: formatting a text file for display by other applications

Postby Phil Last on Wed Apr 11, 2018 9:57 pm

Just a guess but whatever PutText is it probably doesn't like 2d data. Try catenating a lineend after the array and ravelling the result.
User avatar
Phil Last
 
Posts: 461
Joined: Thu Jun 18, 2009 6:29 pm

Re: formatting a text file for display by other applications

Postby Stu on Sat Apr 14, 2018 2:07 am

PutText is in the Files namespace that comes with the current Dyalog distribution. When I display my 3-column array of coordinates on the screen, it looks like the newline character is already there because I get three correct columns.
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: formatting a text file for display by other applications

Postby Phil Last on Sat Apr 14, 2018 8:00 am

      ⍕⍉(3,×/⍴M)⍴x,y,z
produces a 2d character array with blanks between the data columns. If you assign it to a, then perhaps
      (,a,⎕ucs 13)
might be an acceptable argument to PutText. I don't know. Maybe it's objecting to something else.
User avatar
Phil Last
 
Posts: 461
Joined: Thu Jun 18, 2009 6:29 pm


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest