Learn R Programming

iRfcb (version 0.5.1)

ifcb_get_mat_names: Get Variable Names from a MAT File

Description

This function reads a .mat file generated the ifcb-analysis repository (Sosik and Olson 2007) and retrieves the names of all variables stored within it.

Usage

ifcb_get_mat_names(mat_file, use_python = FALSE)

Value

A character vector of variable names.

Arguments

mat_file

A character string specifying the path to the .mat file.

use_python

Logical. If TRUE, attempts to read the .mat file using a Python-based method. Default is FALSE.

Details

If use_python = TRUE, the function tries to read the .mat file using ifcb_read_mat(), which relies on SciPy. This approach may be faster than the default approach using R.matlab::readMat(), especially for large .mat files. To enable this functionality, ensure Python is properly configured with the required dependencies. You can initialize the Python environment and install necessary packages using ifcb_py_install().

If use_python = FALSE or if SciPy is not available, the function falls back to using R.matlab::readMat().

References

Sosik, H. M. and Olson, R. J. (2007), Automated taxonomic classification of phytoplankton sampled with imaging-in-flow cytometry. Limnol. Oceanogr: Methods 5, 204–216.

See Also

Examples

Run this code
# Example .mat file included in the package
mat_file <- system.file("exdata/example.mat", package = "iRfcb")

# Get variable names from a MAT file
variables <- ifcb_get_mat_names(mat_file)
print(variables)

Run the code above in your browser using DataLab