Java Matrix to String matrixToString(float[][][] matrix)

Here you can find the source of matrixToString(float[][][] matrix)

Description

Write the full matrix to a string

License

CeCILL license

Parameter

Parameter Description
matrix a parameter

Return

a string with the matrix (space separated values)

Declaration

public static String matrixToString(float[][][] matrix) 

Method Source Code

//package com.java2s;
//License from project: CeCILL license 

public class Main {
    public static final String SEPARATOR = " ";

    /**//from www  .  ja  v a 2  s.c om
     * Write the full matrix to a string
     * 
     * @param matrix
     * @return a string with the matrix (space separated values)
     */
    public static String matrixToString(float[][][] matrix) {
        StringBuffer out = new StringBuffer();
        for (int k = 0; k < matrix[0][0].length; k++) {
            for (int i = matrix.length - 1; i >= 0; i--) {
                for (int j = 0; j < matrix[0].length; j++) {
                    out.append(matrix[i][j][k]);
                    // change here for format (presently space separated values
                    out.append(SEPARATOR);
                }
                out.append("\n");
            }
            out.append("\n");
        }
        return out.toString();
    }
}

Related

  1. array2DToString(int[][] grid)
  2. formatTable(String[][] table)
  3. matrix2string(int[][] matrix)
  4. matrix_toString(int[][] matrix)
  5. matrixToString(double[][] matrix, int digit, String[] names)
  6. matrixToString(int[][] m)
  7. matrixToString(int[][] matrix, String sep)
  8. matrixToString(String[][] m)
  9. toString(double[][] A)