| 1 | #!/usr/bin/env perl |
| 2 | |
| 3 | use warnings; |
| 4 | use strict; |
| 5 | use PDL; |
| 6 | use PDL::IO::Matlab; |
| 7 | |
| 8 | |
| 9 | my $f1 = 'Rep_Carlo_90nm.mat'; |
| 10 | my $mat1 = PDL::IO::Matlab->new($f1, '<'); |
| 11 | print "Matlab file format of $f1 is " . $mat1->get_version . "\n"; |
| 12 | $mat1->print_all_var_info( print_data => 1 ) ; |
| 13 | $mat1->close; |
| 14 | |
| 15 | my $f2 = 'testf_mat73.mat'; |
| 16 | my $mat2 = PDL::IO::Matlab->new($f2, '>', { header => 'This is the header' }); |
| 17 | $mat2->close; |
| 18 | |
| 19 | $mat2 = PDL::IO::Matlab->new($f2, '<'); |
| 20 | print "Matlab file format of $f2 is " . $mat2->get_version . "\n"; |
| 21 | $mat2->close; |
| 22 | |
| 23 | my $f3 = 'testf_mat5.mat'; |
| 24 | my $mat3 = PDL::IO::Matlab->new($f3, '>', {format => 'MAT5'}); |
| 25 | $mat3->close; |
| 26 | |
| 27 | $mat3 = PDL::IO::Matlab->new($f3, '<'); |
| 28 | print "Matlab file format of $f3 is " . $mat3->get_version . "\n"; |
| 29 | $mat3->close; |
| 30 | |
| 31 | my $f4 = 'test_mat73a.mat'; |
| 32 | my $mat4 = PDL::IO::Matlab->new($f4, '>', {format => 'MAT73'}); |
| 33 | $mat4->close; |
| 34 | |
| 35 | $mat4 = PDL::IO::Matlab->new($f4, 'r'); |
| 36 | print "Matlab file version of $f4 is " . $mat4->get_version . "\n"; |
| 37 | print "Matlab file format of $f4 is " . $mat4->get_format . "\n"; |
| 38 | $mat4->close; |
| 39 | |
| 40 | print join('.',PDL::IO::Matlab::get_library_version()), "\n"; |
| 41 | |
| 42 | 1; |