> From: Mike Day > Though there should be > some csv file routines in the example J scripts provided with > your installation if you're using that format.
Depending on the format of your file of numbers you might find the 'tables/dsv' addon useful for reading and writing delimited values to and from a file: <http://www.jsoftware.com/jwiki/Addons/tables/dsv> Following in Mike's footsteps: load 'tables/dsv' ]array=: makenum ' ' readdsv 'c:\user\data.txt' 0 1 2 3 4 5 6 7 8 ]array2=: 30+i.3 3 NB. create another array 30 31 32 33 34 35 36 37 38 ]rndposit=: 3 3...@$2 NB. create mask of cells to change 1 0 0 0 1 1 0 0 0 ]newarray=: rndposit}array,:array2 NB. another amend syntax 30 1 2 3 34 35 6 7 8 newarray writedsv 'c:\user\newdata.txt';' ' 24 NB. 24 bytes written to c:\user\newdata.txt using space-delimited newarray. Here are a couple of variations on the amend usage illustrated above: (2|array)}array,:_1 NB. replace odd members of array with _1 0 _1 2 _1 4 _1 6 _1 8 ]array3=: i. 3 4 0 1 2 3 4 5 6 7 8 9 10 11 (3|array3)}(array3,:_1),3 4...@$0 0 _1 0.817135 3 _1 0.443886 6 _1 0.629304 9 _1 0.41772 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
