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

Home » Public Forums » archive » Re: Want to get Array(48) instead of Array(1,48)
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: Want to get Array(48) instead of Array(1,48) [message #29872 is a reply to message #29871] Mon, 25 March 2002 18:42 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"chi-kuei" <twcollie@hotmail.com> wrote in message
news:a7om25$8jn$1@news01.cit.cornell.edu...

> ...I notice they are different because when I use curvefit, the
> Array[1,48] will give me error message, the Array[48] will not.
>
> I can make the Array[1,48] become Array[48] without changing the
> value by doing this:
>
> IDL> test_array = test_array(*)
>
> This means extra steps. Am I doing this in the longer way? Is there
> any shortcut of doing this.

No, there is no real shortcut. It is common when using IDL to find
that you have the data you want but the array is not shaped exactly
how you need it. The most versatile and efficient solution is to use
the REFORM function. If it is called with a single argument (the array
to be reshaped) then it will strip out all unit dimensions. Since the
number of elements in the array is not being changed you can use the
OVERWRITE keyword for greater efficiency, thus:

IDL> test_array = reform(test_array, /OVERWRITE)

--

Mark Hadfield
m.hadfield@niwa.co.nz Ka puwaha et tai nei
http://katipo.niwa.co.nz/~hadfield Hoea tatou
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: FIND the indexes of a value in a matrix
Next Topic: Transparent texture mapped polygons

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

Current Time: Fri Oct 10 17:43:45 PDT 2025

Total time taken to generate the page: 0.80042 seconds