Skip to content

Commit 3288320

Browse files
ppavlidisarteymix
authored andcommitted
more writing options
1 parent a68a5b9 commit 3288320

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/ubic/basecode/io/writer/MatrixWriter.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.Iterator;
3030
import java.util.Map;
3131

32+
import cern.colt.matrix.DoubleMatrix1D;
3233
import cern.colt.matrix.DoubleMatrix2D;
3334
import ubic.basecode.dataStructure.matrix.Matrix2D;
3435
import ubic.basecode.dataStructure.matrix.Matrix3D;
@@ -194,6 +195,23 @@ public void writeMatrix(DoubleMatrix2D coltMatrix) throws IOException {
194195
buf.append("\n");
195196
}
196197
out.write(buf.toString());
198+
out.close();
199+
}
200+
201+
202+
/**
203+
* Write a bare 1D matrix (one value per line)
204+
* @param coltMatrix
205+
* @throws IOException
206+
*/
207+
public void writeMatrix(DoubleMatrix1D coltMatrix) throws IOException {
208+
StringBuffer buf = new StringBuffer();
209+
for (int i = 0; i < coltMatrix.size(); i++) {
210+
buf.append(coltMatrix.get(i));
211+
buf.append("\n");
212+
}
213+
out.write(buf.toString());
214+
out.close();
197215
}
198216

199217
/**

0 commit comments

Comments
 (0)