R/read.mat.Witec.R

## ' @export
read.mat.Witec <- function (file = stop ("filename or connection needed")){
  if (! requireNamespace ("R.matlab"))
    stop ("package 'R.matlab' needed.")
  
  data <- R.matlab::readMat (file)
  
  if (length (data) > 1L)
    stop ("Matlab file contains more than 1 object. This should not happen.\n",
          "If it is nevertheless a WITec exported .mat file, please contact the ",
          "maintainer (", maintainer("hyperSpec"), ") with\n", 
          "- output of `sessionInfo ()` and\n",
          "- an example file")
  spcname <- names (data)
  data <- data [[1]]
    
  spc <- new ("hyperSpec", spc = data$data)
  
  spc$spcname <- spcname
  ## consistent file import behaviour across import functions
  .fileio.optional (spc, file)
}

Try the hyperSpec package in your browser

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

hyperSpec documentation built on May 2, 2019, 5:45 p.m.