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

Home » Public Forums » archive » Want to get Array(48) instead of Array(1,48)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Want to get Array(48) instead of Array(1,48) [message #29873] Mon, 25 March 2002 18:24 Go to next message
chi-kuei is currently offline  chi-kuei
Messages: 5
Registered: March 2002
Junior Member
Hi,

It occurs to me that when I do the following:

IDL> test_array = fltarr(48)
test_array is Array[48]

but when I assign the value from a 2-D array
IDL> test_array = data_array(0, 0:47)
test_array becomes Array[1,48]

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.

Thanks,
Chi-Kuei
Re: Want to get Array(48) instead of Array(1,48) [message #29966 is a reply to message #29873] Tue, 26 March 2002 05:59 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
chi-kuei wrote:
>
> Hi,
>
> It occurs to me that when I do the following:
>
> IDL> test_array = fltarr(48)
> test_array is Array[48]
>
> but when I assign the value from a 2-D array
> IDL> test_array = data_array(0, 0:47)
> test_array becomes Array[1,48]
>
> 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(*)

or better still:

IDL> test_array = REFORM( data_array(0, 0:47) )

With no other arguments, REFORM "strips out" all the degenerate dimensions.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: REBIN Question
Next Topic: updating a different widget from the event handler

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

Current Time: Wed Oct 08 14:52:47 PDT 2025

Total time taken to generate the page: 0.00589 seconds