I read a matlab file with the R.matlab package and get a number from it as a list. I turn it into a numeric:
library(R.matlab)
# simple case: static filename
setwd("C:/Files/Fold")
nc <- readMat('passvar1.mat')
nC <- as.numeric(nc)
nC
## 10
More complex cast: I need to open file in folder in R with nC
in name: C:/Files/Coordinates/CoordsRS%nC%.md.txt
All files have same name apart from number, for example:
C:/Files/Coordinates/CoordsR4.md.txt
C:/Files/Coordinates/CoordsR10.md.txt
and, I need to apply operation to this file contents (i.e. pass in a parameter to readMat
so it can read them dynamically)