public static String createMatlabString(double[][] matrix){
  StringBuffer matrixString=new StringBuffer();
  if (matrix == null) {
    return "";
  }
  matrixString.append("[");
  int numberOfColumns=matrix.length;
  int numberOfRows=matrix[0].length;
  for (int i=0; i < numberOfRows; i++) {
    for (int j=0; j < numberOfColumns - 1; j++) {
      matrixString.append(matrix[i][j] + VALUE_DELIMITER);
    }
    matrixString.append(matrix[i][numberOfColumns - 1] + ROW_DELIMITER);
  }
  ;
  matrixString.deleteCharAt(matrixString.length() - 1);
  matrixString.append("]");
  return matrixString.toString();
}

public static String createMatlabString ( double [ ] [ ] matrix ) { StringBuffer matrixString = new StringBuffer ( ) ; if ( matrix == null ) { return "" ; } matrixString . append ( "[" ) ; int numberOfColumns = matrix . length ; int numberOfRows = matrix [ 0 ] . length ; for ( int i = 0 ; i < numberOfRows ; i ++ ) { for ( int j = 0 ; j < numberOfColumns - 1 ; j ++ ) { matrixString . append ( matrix [ i ] [ j ] + VALUE_DELIMITER ) ; } matrixString . append ( matrix [ i ] [ numberOfColumns - 1 ] + ROW_DELIMITER ) ; } ; matrixString . deleteCharAt ( matrixString . length ( ) - 1 ) ; matrixString . append ( "]" ) ; return matrixString . toString ( ) ; }
creates a matlab string from a given double matrix
