Good points Bill. I was aware that my solution wasn't going to work across 
platforms.  I added the CRLF comment to try and highlight that, but it would 
have been more considerate of me to make the example portable.

My only excuse was that we had no idea of the format of the source file so 
whatever conversion routine I used would probably have to be replaced anyway!
-----Original Message-----
From: bill lam <[email protected]>
Sent: Monday, 17 August 2009 17:31
To: [email protected] <[email protected]>
Subject: Re: [Jprogramming] batch viewmat?


On Mon, 17 Aug 2009, Sherlock Ric wrote:
> convert2BMP=: 3 : 0
>   fname=. >y
>   mydat=. fread fname
>   mydat=. 0&"....@}: ;._2 mydat NB. convert CRLF file to numeric matrix
>   bmpdat=. 1{:: '' getvm_jviewmat_ mydat
>   bmpdat writebmp 'bmp',~ _3}.fname
> )
>

Apparently Ronon use *nix so that line ending should be just LF, a
cross-platform solution might be
   mydat=. 0&". ;._2 toJ mydat NB. convert LF file to numeric matrix

Assuming that file did not miss line ending at EOF, otherwise
   mydat=. 0&". ;._2 ,&LF^:(LF~:{:) toJ mydat

(untested)

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to