public static String toString(double M[][],String name){
  StringBuilder sb=new StringBuilder(name + " = [\n");
  for (int j=0; j < M.length; j++) {
    for (int k=0; k < M[j].length; k++) {
      sb.append(String.format("%6.2f ",M[j][k]));
    }
    sb.append(";\n");
  }
  sb.append("]");
  return sb.toString();
}

public static String toString ( double M [ ] [ ] , String name ) { StringBuilder sb = new StringBuilder ( name + " = [\n" ) ; for ( int j = 0 ; j < M . length ; j ++ ) { for ( int k = 0 ; k < M [ j ] . length ; k ++ ) { sb . append ( String . format ( "%6.2f " , M [ j ] [ k ] ) ) ; } sb . append ( ";\n" ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; }
tostring - return a string representation of ' m ' , in matlab format , called ' name ' .
