ReadWriteableMatrix extends Matrix implements ReadWriteable { @Override public void writeASCII(PrintWriter out) throws IOException { final int rows = this.getRowDimension(); final int cols = this.getColumnDimension(); final double[][] data = this.getArray(); out.print(rows + " " + cols); out.println(); for (int r=0; r<rows; r++) { for (int c=0; c<cols; c++) { out.print(data[r][c] + " "); } out.println(); } } protected  ReadWriteableMatrix();  ReadWriteableMatrix(double[][] data);  ReadWriteableMatrix(int rows, int cols);  ReadWriteableMatrix(Matrix data); @Override void readASCII(Scanner in); @Override String asciiHeader(); @Override void readBinary(DataInput in); @Override byte[] binaryHeader(); @Override void writeASCII(PrintWriter out); @Override void writeBinary(DataOutput out);  }
@Test public void testAsciiIO() throws IOException { for (ReadWriteableMatrix m : rndMats) { File tmp = folder.newFile("openimaj-testAsciiIO.mat"); IOUtils.writeASCII(tmp, m); ReadWriteableMatrix m2 = IOUtils.read(tmp, ReadWriteableMatrix.class); compareMatrices(m, m2); tmp.delete(); } }