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

Home » Public Forums » archive » how can i get an [n,1] array without reform?
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 can i get an [n,1] array without reform? [message #63844] Thu, 20 November 2008 10:15
mccreigh is currently offline  mccreigh
Messages: 13
Registered: January 2008
Junior Member
This seems so trivial, but I cant figure out anyway of doing this
without using reform and querying the dimensions of the variables,
which i'm afraid will slow me down! :)

in the simplest case, i have two column vectors. everything is fine
when they have more than 1 row.
eg

IDL> a=transpose([0,1])
IDL> b=transpose([1,2])
IDL> c=[a,b]
IDL> print,c
0 1
1 2

My problem comes when a and b shrink to 1 element each.

From the damned if you do department, you can try to concatenate two
row vectors and then transpose:

IDL> a=[0]
IDL> b=[2]
IDL> c=[[a],[b]]
IDL> help,c
C INT = Array[1, 2]

oh, things are looking good... but,

IDL> c=transpose(c)
IDL> help,c
C INT = Array[2]

!!

if there were only some sort of option to transpose that preserved the
number of dimensions. You can specify the dimensions of the result of
transpose, but you have to know them in advance, ie calculate them.

Sorry if I seem obstinate in not wanting to calculate my dimensions.
But you think i could just get a row vector with dims [n,1].

seems like a kind of IDL bar puzzle. or maybe it's easier than that.

Thanks!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: dependency tree / call graph in idl (cscope for idl)?
Next Topic: loop for 365 days with 18 days interval

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

Current Time: Wed Oct 08 13:39:10 PDT 2025

Total time taken to generate the page: 0.00531 seconds