Given the array a:

]a=.10 10$0=23|i.100

1 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 1 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 1 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 1

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 0 0


How can I write a function 'ac' that will list the coordinates of each 1 in
the array?

Example using array a:

ac a

0 0

2 3

4 6

6 9

9 3

Extend to 3 or more dimensions?

Skip Cave
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to