El 16.02.2011, a las 15:58, Chris Marshall escribió:

> On 2/16/2011 8:48 AM, Arturo Narros González wrote:
> >
> > Thanks for the answer, I would put with verbose flag
> > and lets see.
> Please be sure to cc the perldl list with your
> replies so that others can benefit and contribute
> from the discussion.

Thanks, you are right. I forgot..... (new). :-)


> > I know I can use rcols().  Actually, I tried to read
> > the same information in a file with 100 columns.  In
> > theory it is possible because rcols() read all the
> > columns in the file.
> 
> You don't say which version of PDL you are using
> but the current release rcols() allows you to
> read in multiple columns into a single pdl using
> [] in the arguments.

I was not using the 5.10 so I have changed and install the newest version of 
pdl with pdl2
Thanks again.

I use rcols with this big file and [] in the argument and it works!!!!!!
Thanks a lot.

> > Unfortunately, I could not do it because when I do not
> > specify the columns (it is the way to read all the
> > columns in the file ), just only read the first.  That's
> > why I was trying to use rcube.
> 
> By default, if no column numbers are given, then
> rcols will read in *all* columns.  Again use the []
> syntax to read into a single pdl.
> 

Thanks for the advice. I usually use command line because I use a lot of pipes, 
but I would take in account your advice.


Thanks for your advices.
Cheers.

Arturo.

> I recommend trying things out in the interactive
> shell (pdl2) as it is easy to cut and paste a
> session into e-mail for questions.  It is very
> hard to read perl -e " " one-liners...  For example:
> 
>    $ pdl2
>    Perldl2 Shell v0.004
>          PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
>          'COPYING' in the PDL distribution. This is free software and you
>          are welcome to redistribute it under certain conditions, see
>          the same file for details.
> 
>    Loaded plugins:
> 
>      Commands
>      Completion
>      CompletionDriver::INC
>      CompletionDriver::Keywords
>      CompletionDriver::LexEnv
>      CompletionDriver::Methods
>      DDS
>      FindVariable
>      History
>      Interrupt
>      LexEnv
>      MultiLine::PPI
>      NiceSlice
>      PDLCommands
>      Packages
>      PrintControl
>      ReadLineHistory
> 
> 
>    Type 'help' for online help
> 
>    Type Ctrl-D or quit to exit
> 
>    Loaded PDL v2.4.7_006
> 
>    load_rcfile: got $HOME = /home/chm
>    load_rcfile: loading /home/chm/.perldlrc
>    pdl> help rcols
>    Module PDL::IO::Misc
>      rcols()
>        Read specified ASCII cols from a file into piddles and perl arrays 
> (also
>        see "rgrep()").
> 
>        For each column number specified, a 1D output PDL will be generated.
>        Anonymous arrays of column numbers generate multicolumn output piddles.
>        An empty anonymous array as column specification will produce a single
>        output data piddle with dim(0) equal to the number of columns 
> available.
> 
>    <...output skipped...>
> 
>          Usage:
>            ($x,$y,...) = rcols( *HANDLE|"filename", { EXCLUDE => '/^!/' }, 
> $col1, $col2, ... )
>                     $x = rcols( *HANDLE|"filename", { EXCLUDE => '/^!/' }, [] 
> )
>            ($x,$y,...) = rcols( *HANDLE|"filename", $col1, $col2, ..., { 
> EXCLUDE => '/^!/' } )
>            ($x,$y,...) = rcols( *HANDLE|"filename", "/foo/", $col1, $col2, 
> ... )
> 
>        e.g.,
> 
>          $x      = PDL->rcols 'file1';         # file1 has only one column of 
> data
>          $x      = PDL->rcols 'file2', [];     # file2 can have multiple 
> columns, still 1 piddle output
>                                                # (empty array ref spec means 
> all possible data fields)
> 
>    <...output skipped...>
> 
> The second example will read all columns into one
> pdl.  I suggest making a small test input file
> that you can experiment with reading.
> 
> Cheers,
> Chris
> 
>> 
>> Thanks again.
>> 
>> Arturo.
>> 
>> 
>> El 16.02.2011, a las 03:24, Chris Marshall escribió:
>> 
>>> On 2/15/2011 11:08 AM, Arturo Narros González wrote:
>>>> 
>>>> I try to read some data using a reader function as:
>>>> sub lector{my $e = rcols "$_[0]",8,{LINES=>"3:-2"};return $e;}
>>>> I tested and it works.
>>>> so I tried to used with rcube as:
>>>> 
>>>> perl -MPDL -e '$PDL::IO::Misc::colsep ="\t";sub lector{my $e = rcols 
>>>> "$_[0]",8,{LINES=>"3:-2"};return $e;} $m= rcube  \&lector, glob("*.conf");'
>>>> 
>>>> but I get the next message:
>>>> 
>>>> PDL: Dimensions must be positive
>>>> Caught at file -e, line 1, pkg main
>>>> 
>>>> I try to see examples with a reader function but I can not find,
>>>> Could anyone help me ?
>>> 
>>> I haven't used the rcube routine myself but
>>> a look at the code suggests that it only
>>> works for reading multiple 2-D images into
>>> a 3-D resulting data volume.
>>> 
>>> If you set $PDL::verbose = 1 you'll get some
>>> diagnostic output from the rcube() call.  Of
>>> course, you can just use rcols() to read in
>>> each data set from your files and place them
>>> in a larger data array yourself.  rcube() is
>>> just some shorthand for that.
>>> 
>>> Cheers,
>>> Chris
>> 
>> 
>> 
>> -----
>> No virus found in this message.
>> Checked by AVG - www.avg.com
>> Version: 10.0.1204 / Virus Database: 1435/3446 - Release Date: 02/15/11
>> 
>> 
>> 
> 

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to