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

Home » Public Forums » archive » Re: How to append a multi dimensional array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to append a multi dimensional array? [message #74248 is a reply to message #74247] Wed, 05 January 2011 05:36 Go to previous messageGo to previous message
Balt is currently offline  Balt
Messages: 16
Registered: May 2010
Junior Member
Thanks Brian. This actually does work when I execute it manually on a
small array:

IDL> array=[1,2,3]
IDL> vector=[4,5,6]
IDL> array = [[array],[reform(vector,3,1)]]
IDL> help,array
ARRAY INT = Array[3, 2]
IDL> print,array
1 2 3
4 5 6

That's exactly what I wanted. However.... when I build it into my
code, it works for the first 2 concatenations, but on the third it
fails, even though the array dimensions are all the same. I'm at a
loss... here's the code, am I missing something?

; now read the baselines
FOR bl = 0, N_ELEMENTS(baselines) - 1 DO BEGIN
READCOL,baselines[bl], ti, pi, FORMAT='D,D', /SILENT
; add a new column to the array for each baseline.
; each baseline data can then be accessed as:
; Phi[*,bl] <= this would return all phase information for baseline
bl
IF bl EQ 0 THEN BEGIN
Phasetime = ti
Phi = pi
ENDIF ELSE BEGIN
Phasetime = [[Phasetime],[reform(ti,N_ELEMENTS(ti),bl)]]
Phi = [[Phi],[reform(pi,N_ELEMENTS(pi),bl)]]
ENDELSE
ENDFOR


It dies with this error when bl = 2:
% REFORM: New subscripts must not change the number elements in TI.

But all the dimensions look identical:
IDL> help,ti
TI DOUBLE = Array[718]
IDL> help,pi
PI DOUBLE = Array[718]
IDL> help,phasetime
PHASETIME DOUBLE = Array[718, 2]
IDL> help,phi
PHI DOUBLE = Array[718, 2]


Confused...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: stl files
Next Topic: Re: stl files

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

Current Time: Sun Oct 12 14:07:18 PDT 2025

Total time taken to generate the page: 1.03901 seconds