\(\text{LoadIntegerMatrix}\)

You can use the \(\text{LoadIntegerMatrix}\) to load an integer matrix from a file.

You can use the \loadintegermatrix backslash command to insert this function.

The following variants of this function are available:

  • \(\text{integer matrix } \text{LoadIntegerMatrix} \left ( \text{<filename>} \right )\)

The \(\text{<filename>}\) parameter is the filename of the file to be loaded.

The function returns the newly loaded integer matrix. The matrix can be stored either in CSV format or in a simple packed binary format. The file type is determined by checking for a file magic number stored at the beginning of the file.

The CSV file can use most common separator characters to separate columns. Supported column separators include tabs, spaces, commas (,), semicolons (;), vertical bars (|), or colons (:). The matrix size is determined based on the maximum number of entries per line and the number of lines.

The binary format is designed to be relatively simple for external applications to implement. For details on the binary format, see File Formats.

The Figure 169 shows how you can use the \(\text{LoadIntegerMatrix}\) function.

../_images/load_integer_matrix_example.png

Figure 169 Example Use Of The LoadIntegerMatrix Function