|
Re: from array to one dimentional array [message #45502 is a reply to message #45501] |
Tue, 13 September 2005 09:42  |
Timm Weitkamp
Messages: 66 Registered: August 2002
|
Member |
|
|
David Fanning wrote:
> steffenfr writes:
>
>> Dear all, I am trying to apply the spearman correlation
>> coefficient to 2 images which means that I have to compare
>> 2 arrays. The R_correlate however works only with one dimentional
>> arrays which means that I need to change the n-dimentional array into a
>> one-dimentional one, for example like that
>>
>> Array: 3by3
>>
>> 111
>> 222
>> 333
>>
>> into the one-dimentianl array (Vector) [9by1] which is [111222333]
>>
>> Does anybody know how do do that in a simple way, or has anybody done
>> it alreay in a program?
>
> I would try REFORM:
>
> s = Size(array, /Dimensions)
> array = Reform(array, s[0]*s[1])
Or simply,
array = array[*]
Cheers,
Timm
Timm Weitkamp, ESRF, Grenoble, France
|
|
|
Re: from array to one dimentional array [message #45504 is a reply to message #45502] |
Tue, 13 September 2005 09:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
steffenfr writes:
> Dear all, I am trying to apply the spearman correlation
> coefficient to 2 images which means that I have to compare
> 2 arrays. The R_correlate however works only with one dimentional
> arrays which means that I need to change the n-dimentional array into a
> one-dimentional one, for example like that
>
> Array: 3by3
>
> 111
> 222
> 333
>
> into the one-dimentianl array (Vector) [9by1] which is [111222333]
>
> Does anybody know how do do that in a simple way, or has anybody done
> it alreay in a program?
I would try REFORM:
s = Size(array, /Dimensions)
array = Reform(array, s[0]*s[1])
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|