How about this?
ndx =: (<"1 each idx)
(,.<"1 contents,.ndx)((>@[EMAIL PROTECTED])`(>@{:@[)`(>@])})each "1 ,.m
+----------+
| 0 46 99 |
| 0 0 0 |
| 0 0 0 |
|23 0 62 |
|42 0 0 |
|44 12 0 |
+----------+
|46 0 0 0|
| 0 0 0 99|
| 0 0 0 0|
| 0 0 0 0|
| 0 0 23 62|
+----------+---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
