R/add_path.R

Defines functions add_path gen_path add_gen_path

Documented in add_gen_path add_path gen_path

#' Create PATHs to add to MATLAB PATHs
#'
#' @param path path to add
#'
#' @return A character vector
#' @examples 
#' add_path("~/")
#' gen_path("~/")
#' gen_path("~/")
#' @export
add_path = function(path) {
  path = sapply(path, function(x) {
    paste0("addpath('", path, "');")
  })
  path = unname(unlist(path))
  return(path)
}

#' @rdname add_path
#' @export
gen_path = function(path) {
  path = sapply(path, function(x) {
    paste0("genpath('", path, "');")
  })
  path = unname(unlist(path))
  return(path)
}

#' @rdname add_path
#' @export
add_gen_path = function(path) {
  path = gen_path(path)
  path = add_path(path)
  path = unname(path)
  return(path)
}

Try the matlabr package in your browser

Any scripts or data that you put into this service are public.

matlabr documentation built on May 1, 2019, 6:35 p.m.