Want to get Array(48) instead of Array(1,48) [message #29873] |
Mon, 25 March 2002 18:24  |
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  |
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
|
|
|