comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Padding arrays - vector subscripts not working
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Padding arrays - vector subscripts not working [message #71642 is a reply to message #71586] Wed, 07 July 2010 11:20 Go to previous messageGo to previous message
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
The following case-statement method is pretty ugly, but it is good for
speed and memory use. I tested your program and it works, but it is
slower than the program below because of its L64INDGEN call.

type = size(array, /type)
out = make_array(dims, type=type, value=filler)
x = (dims - sz)/2

case numdims of
1: out[x[0]] = array
2: out[x[0], x[1]] = array
3: out[x[0], x[1], x[2]] = array
4: out[x[0], x[1], x[2], x[3]] = array
5: out[x[0], x[1], x[2], x[3], x[4]] = array
6: out[x[0], x[1], x[2], x[3], x[4], x[5]] = array
7: out[x[0], x[1], x[2], x[3], x[4], x[5], x[6]] = array
8: out[x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]] = array
endcase

return, out
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Subtracting a single variable from an array
Next Topic: Opinions: passing paths, variables, etc. to compiled IDL routine

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:32:46 PDT 2025

Total time taken to generate the page: 0.00428 seconds