|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jmatio.io.MatFileWriter
public class MatFileWriter
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');
Constructor Summary | |
---|---|
MatFileWriter()
Creates the new instance |
|
MatFileWriter(File file,
Collection<MLArray> data)
Writes MLArrays into File . |
|
MatFileWriter(String fileName,
Collection<MLArray> data)
Writes MLArrays into file given by fileName . |
|
MatFileWriter(WritableByteChannel channel,
Collection<MLArray> data)
Writes MLArrays into OuputSteram . |
Method Summary | |
---|---|
void |
write(File file,
Collection<MLArray> data)
Writes MLArrays into File |
void |
write(String filepath,
Collection<MLArray> data)
Writes MLArrays into file created from
filepath . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatFileWriter()
MatFileWriter
instance
public MatFileWriter(String fileName, Collection<MLArray> data) throws IOException
fileName
.
fileName
- - name of ouput filedata
- - Collection
of MLArray
elements
IOException
DataFormatException
public MatFileWriter(File file, Collection<MLArray> data) throws IOException
File
.
file
- - an output File
data
- - Collection
of MLArray
elements
IOException
DataFormatException
public MatFileWriter(WritableByteChannel channel, Collection<MLArray> data) throws IOException
OuputSteram
.
Writes MAT-file header and compressed data (miCOMPRESSED
).
output
- - OutputStream
data
- - Collection
of MLArray
elements
IOException
Method Detail |
---|
public void write(String filepath, Collection<MLArray> data) throws IOException
MLArrays
into file created from
filepath
.
filepath
- the absolute file path of a MAT-file to which data is writtendata
- the collection of MLArray
objects
IOException
- if error occurred during MAT-file writingpublic void write(File file, Collection<MLArray> data) throws IOException
MLArrays
into File
file
- the MAT-file to which data is writtendata
- the collection of MLArray
objects
IOException
- if error occurred during MAT-file writing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |