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

Home » Public Forums » archive » How to reform a 3-D array?
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
How to reform a 3-D array? [message #90603] Fri, 13 March 2015 09:20 Go to next message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello,

I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?

Any suggestions would be of great help.

Thanking you in advance,
Regards,
Madhavan
Re: How to reform a 3-D array? [message #90604 is a reply to message #90603] Fri, 13 March 2015 09:24 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, March 13, 2015 at 5:20:29 PM UTC+1, Madhavan Bomidi wrote:
> Hello,
>
> I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?
>
> Any suggestions would be of great help.
>
> Thanking you in advance,
> Regards,
> Madhavan

Would this do:
IDL> a = bytarr(3,50,100)
IDL> help, transpose(a,[0,2,1])
<Expression> BYTE = Array[3, 100, 50]

Cheers,
Helder
Re: How to reform a 3-D array? [message #90605 is a reply to message #90604] Fri, 13 March 2015 09:27 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, March 13, 2015 at 5:24:58 PM UTC+1, Helder wrote:
> On Friday, March 13, 2015 at 5:20:29 PM UTC+1, Madhavan Bomidi wrote:
>> Hello,
>>
>> I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?
>>
>> Any suggestions would be of great help.
>>
>> Thanking you in advance,
>> Regards,
>> Madhavan
>
> Would this do:
> IDL> a = bytarr(3,50,100)
> IDL> help, transpose(a,[0,2,1])
> <Expression> BYTE = Array[3, 100, 50]
>
> Cheers,
> Helder

Here is a better example:
IDL> file1 = FILEPATH('Night.jpg', SUBDIRECTORY=['examples','data'])
IDL> read_jpeg, file1, a
IDL> help, a
A BYTE = Array[3, 1024, 512]
IDL> image(transpose(a,[0,2,1]))

This way the image is...weel, transposed.

Cheers,
Helder
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FG translation and fg getData/setData
Next Topic: X Windows display

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

Current Time: Wed Oct 08 13:32:03 PDT 2025

Total time taken to generate the page: 0.00468 seconds