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

Home » Public Forums » archive » how can I read many columns and rows
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 read many columns and rows [message #92929] Tue, 29 March 2016 11:20 Go to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
Hi everyone,
I have data file contains 30 column, every column contains 20 row. How can I read this file ?
Re: how can I read many columns and rows [message #92931 is a reply to message #92929] Tue, 29 March 2016 11:53 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
If you want to roll your own reader you can have a look at:
http://www.harrisgeospatial.com/docs/READ.html
And this can be helpful
http://www.harrisgeospatial.com/docs/FILE_LINES.html

If you want to get a little you can try
http://www.harrisgeospatial.com/docs/ASCII_TEMPLATE.html
and then
http://www.harrisgeospatial.com/docs/READ_ASCII.html

On 03/29/16 14:20, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?
>
Re: how can I read many columns and rows [message #92932 is a reply to message #92929] Wed, 30 March 2016 02:35 Go to previous messageGo to next message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
On Tuesday, March 29, 2016 at 7:21:02 PM UTC+1, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

If all values are of the same type it's trivial:

a = fltarr(30, 20)
OPENR, 1, filename
READF, 1, a
CLOSE, 1
Re: how can I read many columns and rows [message #92933 is a reply to message #92929] Wed, 30 March 2016 07:25 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

OK, If I want to make operations on specific column how can I do it
Re: how can I read many columns and rows [message #92937 is a reply to message #92933] Wed, 30 March 2016 13:28 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 03/30/2016 04:25 PM, Ali Gamal wrote:
> OK, If I want to make operations on specific column how can I do it

You are lucky, IDL is an array programming language! For example, you
can do:

out = column1 * column1 + column2
Re: how can I read many columns and rows [message #92943 is a reply to message #92929] Thu, 31 March 2016 06:33 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

thank you, but how can I define column1, column2 in my program
Re: how can I read many columns and rows [message #92945 is a reply to message #92929] Thu, 31 March 2016 07:55 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

I have file data contains many columns, I want to know How can I read this file?, then how can I define each column to use this column in mathematical operations?.
Re: how can I read many columns and rows [message #92946 is a reply to message #92945] Thu, 31 March 2016 09:39 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Thursday, March 31, 2016 at 10:55:03 AM UTC-4, Ali Gamal wrote:
> On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
>> Hi everyone,
>> I have data file contains 30 column, every column contains 20 row. How can I read this file ?
>
> I have file data contains many columns, I want to know How can I read this file?, then how can I define each column to use this column in mathematical operations?.

Several previous posters already told you how to read the data into an array.

Once you have an array, arr, then you can, for example, select the 6th column

column5 = arr[5,*]
Re: how can I read many columns and rows [message #92948 is a reply to message #92929] Thu, 31 March 2016 10:38 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

when I run my IDL program
;;;;;;;;;;;;;;;;;;;;;;;
a = fltarr(6, 50)
OPENR, 1, 'H:\a.dat'
READF, 1, a
CLOSE, 1
column5=a[5,*]
print,column5
end
;;;;;;;;;;;;;;;;;;;;;
it does not print whole column 6 but it print half of column then repeat it as
3910.30
3939.00
3987.40
4052.60
4119.90
4187.30
4255.50
4316.80
4381.10
4448.40
4505.70
4568.90
4624.30
4680.70
4755.30
4846.50
4963.10
5124.50
5308.60
5564.50
6038.90
6617.80
7283.90
8065.40
8500.00
................ it repeat again
3910.30
3939.00
3987.40
4052.60
4119.90
4187.30
4255.50
4316.80
4381.10
4448.40
4505.70
4568.90
4624.30
4680.70
4755.30
4846.50
4963.10
5124.50
5308.60
5564.50
6038.90
6617.80
7283.90
8065.40
8500.00
...........
what is the problem
Re: how can I read many columns and rows [message #92949 is a reply to message #92948] Thu, 31 March 2016 11:50 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I would check your assumptions. For example, you previously told us that your array contained 30 columns, 20 rows. But for some reason you dimension your array fltarr(6,50), which has 300 elements instead of 600. Maybe that is why only half the column is being read?

On Thursday, March 31, 2016 at 1:38:05 PM UTC-4, Ali Gamal wrote:
> On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
>> Hi everyone,
>> I have data file contains 30 column, every column contains 20 row. How can I read this file ?
>
> when I run my IDL program
> ;;;;;;;;;;;;;;;;;;;;;;;
> a = fltarr(6, 50)
> OPENR, 1, 'H:\a.dat'
> READF, 1, a
> CLOSE, 1
> column5=a[5,*]
> print,column5
> end
> ;;;;;;;;;;;;;;;;;;;;;
> it does not print whole column 6 but it print half of column then repeat it as
> 3910.30
> 3939.00
> 3987.40
> 4052.60
> 4119.90
> 4187.30
> 4255.50
> 4316.80
> 4381.10
> 4448.40
> 4505.70
> 4568.90
> 4624.30
> 4680.70
> 4755.30
> 4846.50
> 4963.10
> 5124.50
> 5308.60
> 5564.50
> 6038.90
> 6617.80
> 7283.90
> 8065.40
> 8500.00
> ................ it repeat again
> 3910.30
> 3939.00
> 3987.40
> 4052.60
> 4119.90
> 4187.30
> 4255.50
> 4316.80
> 4381.10
> 4448.40
> 4505.70
> 4568.90
> 4624.30
> 4680.70
> 4755.30
> 4846.50
> 4963.10
> 5124.50
> 5308.60
> 5564.50
> 6038.90
> 6617.80
> 7283.90
> 8065.40
> 8500.00
> ...........
> what is the problem
Re: how can I read many columns and rows [message #92950 is a reply to message #92929] Thu, 31 March 2016 12:50 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

I change dimension to array fltarr(6,50) for test only. It is another file. my new file is 6 columns and every column contains 50 row. I guess this problem because my data as this form

1.402E+00 3.700E-01 1.443E+00
1.403E+00 3.711E-01 1.443E+00
1.405E+00 3.724E-01 1.442E+00
1.406E+00 3.740E-01 1.442E+00
1.408E+00 3.762E-01 1.441E+00
1.411E+00 3.789E-01 1.440E+00
1.415E+00 3.823E-01 1.439E+00
1.417E+00 3.862E-01 1.438E+00
1.417E+00 3.907E-01 1.437E+00
1.418E+00 3.962E-01 1.436E+00
1.419E+00 4.026E-01 1.435E+00
1.415E+00 4.097E-01 1.435E+00
1.411E+00 4.180E-01 1.434E+00
1.407E+00 4.275E-01 1.432E+00
1.400E+00 4.382E-01 1.431E+00
1.392E+00 4.503E-01 1.428E+00
1.382E+00 4.639E-01 1.424E+00
1.371E+00 4.790E-01 1.418E+00
1.359E+00 4.959E-01 1.412E+00
1.344E+00 5.145E-01 1.404E+00
1.326E+00 5.346E-01 1.394E+00
1.307E+00 5.567E-01 1.383E+00
1.286E+00 5.806E-01 1.370E+00
1.263E+00 6.063E-01 1.355E+00
1.237E+00 6.335E-01 1.337E+00
1.209E+00 6.622E-01 1.318E+00
1.179E+00 6.919E-01 1.296E+00
1.149E+00 7.221E-01 1.272E+00
1.119E+00 7.526E-01 1.246E+00
1.089E+00 7.823E-01 1.219E+00
1.059E+00 8.107E-01 1.191E+00
1.031E+00 8.372E-01 1.162E+00
1.005E+00 8.614E-01 1.134E+00
9.806E-01 8.824E-01 1.106E+00
9.610E-01 9.012E-01 1.081E+00
9.449E-01 9.169E-01 1.058E+00
9.325E-01 9.294E-01 1.038E+00
9.230E-01 9.387E-01 1.021E+00
9.179E-01 9.466E-01 1.008E+00
9.176E-01 9.556E-01 9.970E-01
9.257E-01 9.701E-01 9.891E-01
9.398E-01 9.859E-01 9.856E-01
9.561E-01 9.982E-01 9.862E-01
9.735E-01 1.007E+00 9.895E-01
9.848E-01 1.007E+00 9.932E-01
9.944E-01 1.008E+00 9.963E-01
9.997E-01 1.006E+00 9.984E-01
1.002E+00 1.004E+00 9.997E-01
1.001E+00 1.002E+00 1.000E+00
1.000E+00 1.000E+00 1.001E+00



1.455E+00 1.461E+00 1.456E+00
1.409E+00 1.429E+00 1.432E+00
1.369E+00 1.395E+00 1.401E+00
1.333E+00 1.360E+00 1.367E+00
1.289E+00 1.314E+00 1.321E+00
1.242E+00 1.261E+00 1.267E+00
1.186E+00 1.198E+00 1.201E+00
1.142E+00 1.146E+00 1.147E+00
1.102E+00 1.100E+00 1.098E+00
1.058E+00 1.047E+00 1.042E+00
1.014E+00 9.957E-01 9.876E-01
9.876E-01 9.647E-01 9.546E-01
9.587E-01 9.302E-01 9.180E-01
9.295E-01 8.953E-01 8.807E-01
9.092E-01 8.706E-01 8.543E-01
8.895E-01 8.466E-01 8.285E-01
8.713E-01 8.242E-01 8.044E-01
8.565E-01 8.060E-01 7.847E-01
8.426E-01 7.887E-01 7.660E-01
8.313E-01 7.746E-01 7.507E-01
8.274E-01 7.691E-01 7.445E-01
8.247E-01 7.652E-01 7.400E-01
8.238E-01 7.635E-01 7.380E-01
8.241E-01 7.636E-01 7.379E-01
8.311E-01 7.715E-01 7.462E-01
8.412E-01 7.835E-01 7.589E-01
8.544E-01 7.995E-01 7.760E-01
8.702E-01 8.190E-01 7.970E-01
8.845E-01 8.373E-01 8.169E-01
9.003E-01 8.578E-01 8.393E-01
9.173E-01 8.804E-01 8.642E-01
9.356E-01 9.051E-01 8.915E-01
9.512E-01 9.270E-01 9.161E-01
9.727E-01 9.564E-01 9.487E-01
9.862E-01 9.764E-01 9.715E-01
1.002E+00 9.987E-01 9.967E-01
1.019E+00 1.024E+00 1.025E+00
1.044E+00 1.057E+00 1.061E+00
1.065E+00 1.085E+00 1.092E+00
1.076E+00 1.099E+00 1.108E+00
1.056E+00 1.075E+00 1.082E+00
1.031E+00 1.043E+00 1.048E+00
1.015E+00 1.022E+00 1.025E+00
9.997E-01 1.002E+00 1.002E+00
1.001E+00 1.002E+00 1.002E+00
9.950E-01 9.942E-01 9.939E-01
9.932E-01 9.921E-01 9.917E-01
9.928E-01 9.918E-01 9.915E-01
9.948E-01 9.942E-01 9.941E-01
9.966E-01 9.963E-01 9.962E-01
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I guess my program take column 1 and column 4 as one column. what is the true way to do it?
Re: how can I read many columns and rows [message #92951 is a reply to message #92950] Thu, 31 March 2016 13:29 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 03/31/16 15:50, Ali Gamal wrote:
> On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
>> Hi everyone,
>> I have data file contains 30 column, every column contains 20 row.
>> How can I read this file ?
>
> I change dimension to array fltarr(6,50) for test only. It is another
> file. my new file is 6 columns and every column contains 50 row. I guess
> this problem because my data as this form
>
> 1.402E+00 3.700E-01 1.443E+00
> 1.403E+00 3.711E-01 1.443E+00

[snip]

> 9.932E-01 9.921E-01 9.917E-01
> 9.928E-01 9.918E-01 9.915E-01
> 9.948E-01 9.942E-01 9.941E-01
> 9.966E-01 9.963E-01 9.962E-01
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> I guess my program take column 1 and column 4 as one column. what is
> the true way to do it?
>

I couldn't find any primers online at Harris but you could have a look
at: http://www.harrisgeospatial.com/docs/idl_programming.html

Or, for reasonably priced books:

http://www.amazon.com/Practical-IDL-Programming-Liam-Gumley/ dp/1558607005

or

http://www.idlcoyote.com/coyotestore/index.php?main_page=pro duct_info&cPath=66&products_id=183

Please understand I'm not trying to be mean spirited here - I really
think you would benefit from some reading material about IDL programming.

cheers,

paulv
Re: how can I read many columns and rows [message #92953 is a reply to message #92929] Fri, 01 April 2016 05:36 Go to previous message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, March 29, 2016 at 8:21:02 PM UTC+2, Ali Gamal wrote:
> Hi everyone,
> I have data file contains 30 column, every column contains 20 row. How can I read this file ?

OK, Thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Response function of a detector in IDL
Next Topic: Coyote Returns

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

Current Time: Wed Oct 08 11:32:18 PDT 2025

Total time taken to generate the page: 0.00512 seconds