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

Home » Public Forums » archive » Re: how to convert a row of data in a column?
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: how to convert a row of data in a column? [message #82904] Fri, 25 January 2013 09:01
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Friday, January 25, 2013 7:57:04 AM UTC-6, pan...@gmail.com wrote:
> Thanks, I solved the problem myself by writing a for loop.

In IDL, for loops are the embodiment of pure evil:

http://www.idlcoyote.com/tips/forloops.html

Well, maybe not so bad sometimes:

http://www.idlcoyote.com/tips/forloops2.html

But, for your problem, you're trying to convert to a row vector into a column vector. A couple ways to that:

IDL> d = TRANSPOSE(set) & help, d

or

IDL> d = REFORM(set, 1, N_ELEMENTS(set))
Re: how to convert a row of data in a column? [message #82905 is a reply to message #82904] Fri, 25 January 2013 05:57 Go to previous message
panklbj is currently offline  panklbj
Messages: 5
Registered: November 2012
Junior Member
Thanks, I solved the problem myself by writing a for loop.
Re: how to convert a row of data in a column? [message #82906 is a reply to message #82905] Fri, 25 January 2013 05:44 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den fredagen den 25:e januari 2013 kl. 14:34:58 UTC+1 skrev pan...@gmail.com:
> I am using an external program which returns me a one dimensional array, .i.e. a row of data like this.
>
>
>
> 1 2 5 7 8 9 0
>
>
>
> The problem is that I need to read it as a column of data. I tried to create an array to store it but it doesn't work.
>
> (Here set=[1 2 5 7 8 9 0])
>
>
>
> d=dblarr(1,7)
>
> set=d
>
>
>
> but when I print set on the screen, it is still
>
> 1 2 5 7 8 9 0
>
> instead of
>
> 1
>
> 2
>
> 5
>
> 7
>
> 8
>
> 9
>
> 0
>
>
>
> what can I do?
>
>
>
> Many thanks

I'm not sure what lines you actually executed, because after the ones you posted both set and d should be a (1,7) array of zeros, which would print as a column and not as a row.

If you replace the set=d line with d[0]=set, the d vector should print as

IDL> print,d
1.0000000
2.0000000
5.0000000
7.0000000
8.0000000
9.0000000
0.0000000
Re: how to convert a row of data in a column? [message #82907 is a reply to message #82906] Fri, 25 January 2013 05:42 Go to previous message
panklbj is currently offline  panklbj
Messages: 5
Registered: November 2012
Junior Member
I realized the following is wrong. I was affected by c++. I tried to create a 0 array and put the values of set in the value. It doesn't work for idl in this way.


d=dblarr(1,7)
set=d
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to convert a row of data in a column?
Next Topic: Re: FFT phase?

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

Current Time: Wed Oct 08 13:34:09 PDT 2025

Total time taken to generate the page: 0.00476 seconds