Folks thank you very much for your excellent help here. Truly appreciated.
I modified the code slightly to send data to a csv file as below.
use Text::CSV; use Math::MatrixReal; my $mref = [ [ '5', '4', '4', '2', '4' ], [ '9', '6', '4', '4', '3' ], [ '2','73','96', '6', '8' ], [ '2', '4', '9','87', '8' ], [ '2', '4','10', '6', '8' ], ]; my $matrix = Math::MatrixReal->new_from_rows( $mref ); # At this point $matrix is a Math::MatrixReal object that # resembles the one you showed us a Data::Dumper dump of. my $csv = Text::CSV->new; open my $FILE, ">", "./whatever.csv"; foreach my $row_num ( 1 .. 5 ) { $csv->print(*STDOUT, [ map { $matrix->element($row_num,$_) } 1 .. 5 +] ); print {*STDOUT} "\n"; $csv->print($FILE, [ map { $matrix->element($row_num,$_) } 1 .. 5 ] +); print $FILE "\n"; }
In reply to Re^6: How to output matrix data from Math:;MatrixReal into a Hash or an Array
by John007
in thread How to output matrix data from Math:;MatrixReal into a Hash or an Array
by John007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |