reform a transposed array [message #94084] |
Mon, 16 January 2017 14:13  |
smnadoum
Messages: 24 Registered: June 2016
|
Junior Member |
|
|
I am having difficulties reforming a transposed array:
e is int =array[3,1,2]
I transposed e to : int = array[2,1,3]
but now I want to reform e to [4,2]:
e = reform(e,4,2,/overwrite)
I know that this function won't work for reforming the array to [4,2] due to the difference in the number of elements.
Is there a way to reform the array e to [4,2]?
Thanks
|
|
|
Re: reform a transposed array [message #94085 is a reply to message #94084] |
Mon, 16 January 2017 17:52   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Monday, January 16, 2017 at 5:13:11 PM UTC-5, Cheryl wrote:
> I am having difficulties reforming a transposed array:
> e is int =array[3,1,2]
> I transposed e to : int = array[2,1,3]
>
> but now I want to reform e to [4,2]:
> e = reform(e,4,2,/overwrite)
>
> I know that this function won't work for reforming the array to [4,2] due to the difference in the number of elements.
>
> Is there a way to reform the array e to [4,2]?
The original array has 6 elements. The desired array has 8 elements. There's no way to use REFORM or REBIN to go to a different number of elements like this. You would be better off computing the elements of your desired array explicitly, one by one.
CM
|
|
|
Re: reform a transposed array [message #94086 is a reply to message #94085] |
Mon, 16 January 2017 18:31  |
smnadoum
Messages: 24 Registered: June 2016
|
Junior Member |
|
|
On Monday, January 16, 2017 at 5:52:51 PM UTC-8, Craig Markwardt wrote:
> On Monday, January 16, 2017 at 5:13:11 PM UTC-5, Cheryl wrote:
>> I am having difficulties reforming a transposed array:
>> e is int =array[3,1,2]
>> I transposed e to : int = array[2,1,3]
>>
>> but now I want to reform e to [4,2]:
>> e = reform(e,4,2,/overwrite)
>>
>> I know that this function won't work for reforming the array to [4,2] due to the difference in the number of elements.
>>
>> Is there a way to reform the array e to [4,2]?
>
> The original array has 6 elements. The desired array has 8 elements. There's no way to use REFORM or REBIN to go to a different number of elements like this. You would be better off computing the elements of your desired array explicitly, one by one.
> CM
Thank you!
|
|
|