comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Replication question

Replication question
type: item
description: 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
creator: Michael Wallace
date: 2005-09-14T23:09:02-00:00