write_matrixT_write_matrixWriteMatrixWriteMatrixwrite_matrix (Operator)


write_matrixT_write_matrixWriteMatrixWriteMatrixwrite_matrix — Write a matrix to a file.


write_matrix( : : MatrixID, FileFormat, FileName : )

Herror T_write_matrix(const Htuple MatrixID, const Htuple FileFormat, const Htuple FileName)

void WriteMatrix(const HTuple& MatrixID, const HTuple& FileFormat, const HTuple& FileName)

void HMatrix::WriteMatrix(const HString& FileFormat, const HString& FileName) const

void HMatrix::WriteMatrix(const char* FileFormat, const char* FileName) const

void HMatrix::WriteMatrix(const wchar_t* FileFormat, const wchar_t* FileName) const   (Windows only)

static void HOperatorSet.WriteMatrix(HTuple matrixID, HTuple fileFormat, HTuple fileName)

void HMatrix.WriteMatrix(string fileFormat, string fileName)

def write_matrix(matrix_id: HHandle, file_format: str, file_name: str) -> None


The operator write_matrixwrite_matrixWriteMatrixWriteMatrixWriteMatrixwrite_matrix writes a matrix to the file FileNameFileNameFileNameFileNamefileNamefile_name. The matrix can be read with read_matrixread_matrixReadMatrixReadMatrixReadMatrixread_matrix. The default HALCON file extension for the matrix is 'mtx'. The format of the file can be selected via the parameter FileFormatFileFormatFileFormatFileFormatfileFormatfile_format. The following values are supported: 'binary'"binary""binary""binary""binary""binary" for a binary file format, and 'ascii'"ascii""ascii""ascii""ascii""ascii" for a ascii text format. In the text format each row of the file contains one row of the matrix. The columns are separated with white spaces. The advantage of using the binary file format instead of the ascii text format is a smaller size of the output file.

Execution Information


MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id (input_control)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle of the input matrix.

FileFormatFileFormatFileFormatFileFormatfileFormatfile_format (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Format of the file.

Default value: 'binary' "binary" "binary" "binary" "binary" "binary"

List of values: 'ascii'"ascii""ascii""ascii""ascii""ascii", 'binary'"binary""binary""binary""binary""binary"

FileNameFileNameFileNameFileNamefileNamefile_name (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name.

File extension: .mtx


If the file name is valid (write permission), the operator write_matrixwrite_matrixWriteMatrixWriteMatrixWriteMatrixwrite_matrix returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors