read_mat#

Read a CSV file into a tensor

Note

This function requires the optional MATX_ENABLE_FILEIO compile flag

template<typename TensorType>
void matx::io::read_mat(TensorType &t, const std::string fname, const std::string var)#

Read a MAT file into a tensor view.

MAT files use SciPy’s loadmat() function to read various MATLAB file types in. MAT files are supersets of HDF5 files, and are allowed to have multiple fields in them.

Template Parameters:

TensorType – Data type of tensor

Parameters:
  • t – Tensor to read data into

  • fname – File name of .mat file

  • var – Variable name inside of .mat to read

template<typename TensorType>
auto matx::io::read_mat(const std::string fname, const std::string var)#

Read a MAT file and return a tensor view.

MAT files use SciPy’s loadmat() function to read various MATLAB file types in. MAT files are supersets of HDF5 files, and are allowed to have multiple fields in them.

Template Parameters:

TensorType – Data type of tensor

Parameters:
  • fname – File name of .mat file

  • var – Variable name inside of .mat to read

Returns:

Tensor view of data read from file

Examples#

// Read "myvar" from mat file
io::read_mat(t, "../test/00_io/test.mat", "myvar");