com.jmatio.io
Class MatFileWriter

java.lang.Object
  extended by com.jmatio.io.MatFileWriter

public class MatFileWriter
extends Object

MAT-file writer. Usage:


 //1. First create example arrays
 double[] src = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 };
 MLDouble mlDouble = new MLDouble( "double_arr", src, 3 );
 MLChar mlChar = new MLChar( "char_arr", "I am dummy" );
         
 //2. write arrays to file
 ArrayList list = new ArrayList();
 list.add( mlDouble );
 list.add( mlChar );
 
 new MatFileWriter( "mat_file.mat", list );
 
this is "equal" to Matlab commands:

 >> double_arr = [ 1 2; 3 4; 5 6];
 >> char_arr = 'I am dummy';
 >>
 >> save('mat_file.mat', 'double_arr', 'char_arr');
 

Author:
Wojciech Gradkowski (wgradkowski@gmail.com)

Constructor Summary
MatFileWriter(DataOutputStream output, Collection<MLArray> data)
          Writes MLArrays into OuputSteram.
MatFileWriter(File file, Collection<MLArray> data)
          Writes MLArrays into File.
MatFileWriter(String fileName, Collection<MLArray> data)
          Writes MLArrays into file given by fileName.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatFileWriter

public MatFileWriter(String fileName,
                     Collection<MLArray> data)
              throws IOException
Writes MLArrays into file given by fileName.

Parameters:
fileName - - name of ouput file
data - - Collection of MLArray elements
Throws:
IOException - if an i/o exception occurs, for instance cause by file access

MatFileWriter

public MatFileWriter(File file,
                     Collection<MLArray> data)
              throws IOException
Writes MLArrays into File.

Parameters:
file - - an output File
data - - Collection of MLArray elements
Throws:
IOException - if an i/o exception occurs, for instance cause by file access

MatFileWriter

public MatFileWriter(DataOutputStream output,
                     Collection<MLArray> data)
              throws IOException
Writes MLArrays into OuputSteram. Writes MAT-file header and compressed data (miCOMPRESSED).

Parameters:
output - - OutputStream
data - - Collection of MLArray elements
Throws:
IOException - if an i/o exception occurs, for instance cause by file access