R/get-matlab.R

Defines functions get_matlab

Documented in get_matlab

#' Get path to matlab file
#'
#' This function is modified from the package `readr` to access
#' the bundled datasets in directory `inst/extdata` of `readmat`. This
#' function make them easy to access. This function is modified from
#' \code{\link[readr:readr_example]{readr_example}} of the package
#' \code{\link[readr]{readr}}.
#'
#' @param path Name of file. If `NULL`, the example files will be listed.
#' @export
#'
#' @examples
#' get_matlab()
get_matlab <- function(path = NULL) {
  if (is.null(path)) {
    dir(system.file("extdata", package = "readmat"))
  } else {
    system.file("extdata", path, package = "readmat", mustWork = TRUE)
  }
}
MartinSchobben/readmat documentation built on May 22, 2022, 11:44 a.m.