Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pdl::char(3) [redhat man page]

Char(3) 						User Contributed Perl Documentation						   Char(3)

NAME
PDL::Char -- PDL subclass which allows reading and writing of fixed-length character strings as byte PDLs SYNOPSIS
use PDL; use PDL::Char; my $pchar = PDL::Char->new( [['abc', 'def', 'ghi'],['jkl', 'mno', 'pqr']] ); $pchar->setstr(1,0,'foo'); print $pchar; # 'string' bound to "", perl stringify function # Prints: # [ # ['abc' 'foo' 'ghi'] # ['jkl' 'mno' 'pqr'] # ] print $pchar->atstr(2,0); # Prints: # ghi DESCRIPTION
This subclass of PDL allows one to manipulate PDLs of 'byte' type as if they were made of fixed length strings, not just numbers. This type of behavior is useful when you want to work with charactar grids. The indexing is done on a string level and not a character level for the 'setstr' and 'atstr' commands. This module is in particular useful for writing NetCDF files that include character data using the PDL::NetCDF module. FUNCTIONS
new Function to create a byte PDL from a string, list of strings, list of list of strings, etc. # create a new PDL::Char from a perl array of strings $strpdl = PDL::Char->new( ['abc', 'def', 'ghij'] ); # Convert a PDL of type 'byte' to a PDL::Char $strpdl1 = PDL::Char->new (sequence (byte, 4, 5)+99); $pdlchar3d = PDL::Char->new([['abc','def','ghi'],['jkl', 'mno', 'pqr']]); string Function to print a character PDL (created by 'char') in a pretty format. $char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] ); print $char; # 'string' bound to "", perl stringify function # Prints: # [ # ['abc' 'def' 'ghi'] # ['jkl' 'mno' 'pqr'] # ] # 'string' is overloaded to the "" operator, so: # print $char; # should have the same effect. setstr Function to set one string value in a character PDL. The input position is the position of the string, not a character in the string. The first dimension is assumed to be the length of the string. The input string will be null-padded if the string is shorter than the first dimension of the PDL. It will be truncated if it is longer. $char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] ); $char->setstr(0,1, 'foobar'); print $char; # 'string' bound to "", perl stringify function # Prints: # [ # ['abc' 'def' 'ghi'] # ['foo' 'mno' 'pqr'] # ] $char->setstr(2,1, 'f'); print $char; # 'string' bound to "", perl stringify function # Prints: # [ # ['abc' 'def' 'ghi'] # ['foo' 'mno' 'f'] -> note that this 'f' is stored "f" # ] atstr Function to fetch one string value from a PDL::Char type PDL, given a position within the PDL. The input position of the string, not a character in the string. The length of the input string is the implied first dimension. $char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] ); print $char->atstr(0,1); # Prints: # jkl perl v5.8.0 2001-05-27 Char(3)

Check Out this Related Man Page

PDL(3)							User Contributed Perl Documentation						    PDL(3)

NAME
PDL - the Perl Data Language DESCRIPTION
(For the exported PDL constructor, pdl(), see PDL::Core or pdl[2]) PDL is the Perl Data Language, a perl extension that is designed for scientific and bulk numeric data processing and display. It extends perl's syntax and includes fully vectorized, multidimensional array handling, plus several paths for device-independent graphics output. For basic information on the PDL language, see the pdl(1) (lowercase) man page. You can run PDL programs directly as perl scripts that include the PDL module (with "use PDL;"), or via an interactive shell (see the perldl(1) man page). The PDL language extension includes about a dozen perl modules that form the core of the language, plus additional modules that add further functionality. The perl module "PDL" loads all of the core modules automatically, making their functions available in the current perl namespace. See also PDL::Lite or PDL::LiteF if start-up time becomes an issue. EXPORTS: "use PDL;" exports a large number of routines into the calling namespace. If you want to avoid namespace pollution, you must instead "use PDL::Lite", and include any additional modules explicitly. NICESLICE: Note that the PDL::NiceSlice syntax is NOT automatically loaded by "use PDL;". If you want to use the extended slicing syntax in a standalone script, you must also say "use PDL::NiceSlice;". PDL::Math: The PDL::Math module has been added to the list of modules for versions later than 2.3.1. Note that PDL::Math is still not included in the Lite and LiteF start-up modules. SYNOPSIS
use PDL; # Is equivalent to the following: use PDL::Core; use PDL::Ops; use PDL::Primitive; use PDL::Ufunc; use PDL::Basic; use PDL::Slices; use PDL::Bad; use PDL::MatrixOps; use PDL::Math; use PDL::Version; use PDL::IO::Misc; use PDL::IO::FITS; use PDL::IO::Pic; use PDL::Lvalue; perl v5.12.1 2010-01-01 PDL(3)
Man Page