Dear Forum,

Perhaps it is a beginners question, but somehow I cannot come up with a decent 
answer.

I have a matrix like of position-value pairs like:

0 0 1 1 1 1 2 2 2 2 2 4 4 4 5 5
5 0 7 8 9 2 2 5 5 5 3 8 0 0 5 6

(it could also be transposed), and I would like to have a list of boxes:

+---+-------+---------++-----+---+
|5 0|7 8 9 2|2 5 5 5 3||8 0 0|5 6|
+---+-------+---------++-----+---+

So the values are placed in boxes according to the positions.

My matrix above is sorted (from left to right), but probably this is not 
essential for most solutions. Furthermore, the order of the elements within the 
boxes of the result is not important for the remainder of my algorithm.

I have a solution that loops through the matrix from left to right, but it is 
way too slow (and it does not look like J). Isn't there a better way?

Thanks,
Ben


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

Reply via email to