On Wed, 27 Feb 2008, The World wrote:

+ I've been playing with the readcvs function and am having a problem with
+ the boxed data. I can read in a 2 dimensional array of boxed character
+ data. I can select any particular column using
+
+ col =. idx {"_1 myboxeddata
+
+ The problem comes in when I want to test each of the boxes in the column
+ to see which one is equal to the single number 1 (as a character of
+ course). I would like to generate an array of 1s and 0s, the 1s being
+ where the number 1 character is. I would like to do this in the
+ following fashion
+
+ col = <'1'
+
+ But I always get 0s as the answer even though the boxed list contains a
+ single boxed 1 character
+
+ I've recreated the problem in simpler form:
+
+ mydata =. |: ;: 1 ]\'0123456789'
+ mydata
+ │0│1│2│3│4│5│6│7│8│9│
+
+ mydata = <'1'

        The problem above is that each box in mydata
contains a rank 1 element and the box in <'1' contains an
element of empty rank.

   $each mydata
+-+-+-+-+-+-+-+-+-+-+
|1|1|1|1|1|1|1|1|1|1|
+-+-+-+-+-+-+-+-+-+-+
   $each(<'1')
++
||
++

        You could try another way to create mydata suggested
by the following.

   (<'1')=,:;/'0123456789'
0 1 0 0 0 0 0 0 0 0

(B=) <----------my "sig"
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to