question: public String toMatlab ( ) { StringBuffer result ; int i ; int n ; result = new StringBuffer ( ) ; result . append ( "[" ) ; for ( i = 0 ; i < getRowDimension ( ) ; i ++ ) { if ( i > 0 ) { result . append ( "; " ) ; } for ( n = 0 ; n < getColumnDimension ( ) ; n ++ ) { if ( n > 0 ) { result . append ( " " ) ; } result . append ( Double . toString ( get ( i , n ) ) ) ; } } result . append ( "]" ) ; return result . toString ( ) ; }
target:  converts the Matrix into a single line Matlab string: matrix is enclosed by parentheses, rows are separated by semicolon and single cells by blanks, e.g., [1 2; 3 4].