See the attached subvi I made to do that for floating point values. The basic idea is to run both arrays into a For loop, but only auto-index on 'Y', the array of indices. Also use auto-indexing to generate the output array.
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.