Skip to content

write_matrixWriteMatrixWriteMatrixwrite_matrixT_write_matrix🔗

Short description🔗

write_matrixWriteMatrixWriteMatrixwrite_matrixT_write_matrix — Write a matrix to a file.

Signature🔗

write_matrix( matrix MatrixID, string FileFormat, filename.write FileName )void WriteMatrix( const HTuple& MatrixID, const HTuple& FileFormat, const HTuple& FileName )static void HOperatorSet.WriteMatrix( HTuple matrixID, HTuple fileFormat, HTuple fileName )def write_matrix( matrix_id: HHandle, file_format: str, file_name: str ) -> None

Herror T_write_matrix( 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)

void HMatrix.WriteMatrix( string fileFormat, string fileName )

Description🔗

The operator write_matrixWriteMatrix writes a matrix to the file FileNamefileNamefile_name. The matrix can be read with read_matrixReadMatrix. The default HALCON file extension for the matrix is 'mtx'. The format of the file can be selected via the parameter FileFormatfileFormatfile_format. The following values are supported: 'binary'"binary" for a binary file format, and '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🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

MatrixIDmatrixIDmatrix_id (input_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the input matrix.

FileFormatfileFormatfile_format (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Format of the file.

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

FileNamefileNamefile_name (input_control) filename.write → (string)HTuple (HString)HTuple (string)strHtuple (char*)

File name.

File extension: .mtx

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

create_matrixCreateMatrix

Module🔗

Foundation