NB. I have a sorted array sa=: 1 2 5 9
NB. I want to expand this to an array of length (maxval+1) rlen=: ((1&+)@(>./)) sa NB. I best picture the expanded array as: ]exparray=: sa sa}(_$~rlen) _ 1 2 _ _ 5 _ _ _ 9 NB. I want to replace the "blanks" above with the NB. nearest value in sa. The desired result should be: desiredresult=: 1 1 2 2 5 5 5 5 9 9 exparray,:desiredresult _ 1 2 _ _ 5 _ _ _ 9 1 1 2 2 5 5 5 5 9 9 NB. Where the first blank is replaced with the nearest value 1, NB. and the next blank is replaced with the nearest value 2 etc. NB. In the case of the blanks between 5 and 9, position 6 NB. gets the value 5, postion 7 takes the lower value of NB. the remaining values 5 and 9 (ties go to the lower value). NB. I've been playing with this problem for a while and I am NB. not making any progress. NB. Suggestions would be greatly appreciated. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
