Re: Displaying Multidimensal Data [message #45791] |
Mon, 03 October 2005 09:01 |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
hocmin,
<hocmin@gmail.com> wrote in message
news:1128351838.383585.129360@g14g2000cwa.googlegroups.com.. .
> I've got a situation where I need to display a multidimensional array
> in a widget_text. The only way I can figure out how to do it is to
> create a complex structure of nested for loops for each dimension.
> Something similar to how print displays the data would work (as long as
> I could add an index before), but I can't get that output into a
> variable.
>
> Does anyone know of an elegant method for displaying multidimensional
> data in IDL?
The STRING function can be used to get the same lines of text that IDL
prints with PRINT:
IDL> a=bindgen(3,2,3,2)
IDL> print,a
0 1 2
3 4 5
6 7 8
9 10 11
12 13 14
15 16 17
18 19 20
21 22 23
24 25 26
27 28 29
30 31 32
33 34 35
IDL> s=string(a,/print)
IDL> help,s
S STRING = Array[17]
IDL> print,s,format='(A)' ; To see each on its own line
0 1 2
3 4 5
6 7 8
9 10 11
12 13 14
15 16 17
18 19 20
21 22 23
24 25 26
27 28 29
30 31 32
33 34 35
Some further trickery based on the dimensions of the array could be used to
stuff indicators in the right places (like: "a[*,*,0,0]" before the first 2D
section) if that's what you meant by "add an index before".
Hope this helps.
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|