ClassesClasses | | Operators

read_matrixread_matrixReadMatrixReadMatrix (Operator)


read_matrixread_matrixReadMatrixReadMatrix — Read a matrix from a file.


read_matrix( : : FileName : MatrixID)

Herror read_matrix(const char* FileName, Hlong* MatrixID)

Herror T_read_matrix(const Htuple FileName, Htuple* MatrixID)

void ReadMatrix(const HTuple& FileName, HTuple* MatrixID)

void HMatrix::HMatrix(const HString& FileName)

void HMatrix::HMatrix(const char* FileName)

void HMatrix::ReadMatrix(const HString& FileName)

void HMatrix::ReadMatrix(const char* FileName)

static void HOperatorSet.ReadMatrix(HTuple fileName, out HTuple matrixID)

public HMatrix(string fileName)

void HMatrix.ReadMatrix(string fileName)


The operator read_matrixread_matrixReadMatrixReadMatrixReadMatrix reads a matrix, which has been written to the file with write_matrixwrite_matrixWriteMatrixWriteMatrixWriteMatrix, from the file FileNameFileNameFileNameFileNamefileName. The default HALCON file extension for the matrix is 'mtx'. The format of the file can be binary or ascii. Each row of the file contains one row of a matrix with a number of columns. The columns are separated with white spaces or tabs. Each row must have the same number of columns. Empty lines are ignored.

The reading results are stored in the matrix MatrixMatrixMatrixMatrixmatrix. The operator returns the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixID of this matrix. Access to the elements of the matrix is possible e.g. with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrix.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.


FileNameFileNameFileNameFileNamefileName (input_control) HTupleHTupleHtuple (string) (string) (HString) (char*)

File name.

File extension: .mtx

MatrixIDMatrixIDMatrixIDMatrixIDmatrixID (output_control)  matrix HMatrix, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Matrix handle.


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

Possible Successors




ClassesClasses | | Operators