Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hey guys, I know there's got to be an easy way to do this, but my brain is cramped up right now. Given an array input, I'd like to output an array where the index of the of the input array is replicated by the corresponding value in the input array. The input array will always contain positive values. For example... input: [1, 2, 1, 4] output: [0, 1, 1, 2, 3, 3, 3, 3] input: [3, 3, 3, 1] output: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3] I know that I could loop over my input array, replicate the loop variable by the value of the input array at each position and concatenate the resulting arrays, but this solution does not seem like "The IDL Way". Any dimensional jugglers out there know a nice looking solution? -Mike