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

Home » Public Forums » archive » Re: Assignment, Form 5 (what they didn't tell you in the manuals)
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
Re: Assignment, Form 5 (what they didn't tell you in the manuals) [message #13541] Thu, 19 November 1998 00:00
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <36534151.3A3E@bigfoot.com> David Ritscher
<davidNO.ritscherSPAM@bigfoot.com> writes:

> Today's matrix subscripting puzzler:
> I'm noting that there are some extra rules govorning assignement
> statements where the right side contains subscripting expressions in
> more than one of the dimensions of a matrix. Given a 3-D array,
> array(indgen(5), indgen(5), indgen(5)) yields a 5-element vector
> array(indgen(5), 0, indgen(5)) yields a 5 x 1 x 5 matrix
>
> I'm trying to create an index that allows me to extract vectors of
> information from a matrix that has been stored. Here is a simple
> example of the form of what I'm trying to extract. The matrix 'index'
> will put the matrix into the order I want.
>
> threeD = indgen(3,4,5)
> twoD = indgen(3,5)
> index = [[indgen(15) mod 3], [indgen(15) / 3]]
[..]

I'm not 100% sure I understand exactly what you want, so let me
rephrase the problem: Your 2d data is lindgen(m,o), and your 3d
data is lindgen(m,n,o). You rearrange your 2d data into a vector
according to the one-dimensional index value, and you want to
arrange corresponding 2d slices (*,j,*) of your 3d data into
vectors, and stack them into an array that's lonarr(m*o,n) ?

Isn't this best solved with TRANSPOSE (which has gotten some
new functionality since I learned it):

out = reform(transpose(threed,[0,2,1]),m*o,n)

?

As I said, I may have misunderstood your question, but if I
haven't, I believe this is the answer...

Stein Vidar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how do I do *that*?
Next Topic: Re: 16-bit colors in Linux (Re: 24 bit colors in IDL)

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

Current Time: Wed Oct 08 17:44:37 PDT 2025

Total time taken to generate the page: 0.00480 seconds