NAME

Lab::Moose::BlockData - Simple two-dimensional numeric data type. Probably it would be simpler/better/cleaner if we just use PDL instead...

SYNOPSIS

 use Lab::Moose::BlockData;
 
 my $data = Lab::Moose::BlockData->new();
 $data->add_column([1, 2, 3]);
 $data->add_column([5, 6, 7]);

 $data->add_row([4, 8]);

 
 my $matrix = $data->matrix; # $matrix is [[1, 5], [2, 6], [3, 7], [4, 8]]

 my $first_row = $data->row(0); # $first_row is [1, 5]

 my $first_col = $data->column(0); # $first_col is [1, 2, 3, 4]

 $data->print_to_file( file => 'somefile.dat' );
 

METHODS

new

 my $data = Lab::Moose::BlockData->new();

or

 my $data = Lab::Moose::BlockData->new( matrix => [[1, 2], [3, 4] );

row

 my $row = $data->row($row_number);

column

 my $col = $data->column($column_number);

add_row

 $data->add_row([1, 2, 3]);

add_column

 $data->add_column([1, 2, 3]);
 $data->print_to_file( file => 'somefile.dat' )

output $data to a file using gnuplot format.

Options:

file

the filename

overwrite
 $data->print_to_file( file => $file, overwrite => 1 );

If this is not set, the call will fail, if the file already exists. Unset by default.

append
 $data->print_to_file( file => $file, append => 1 );

Open file in append-mode. Unset by default.