Displaying 1 result from an estimated 1 matches for "stringarr".
Did you mean:
stringarm
2002 Feb 25
0
Example function for reading Octave data files made by "save -ascii"
...n(con) {
## Helper function: read in a matrix.
nrows <- as.numeric(substring(readLines(con,1), 9))
ncols <- as.numeric(substring(readLines(con,1), 12))
data <- scan(con, nlines=nrows, quiet=T)
d <- matrix(data, nrow=nrows, ncol=ncols, byrow=T)
d
}
read.oct.stringarr <- function(con) {
## Helper function: read in a string array.
elements <- as.numeric(substring(readLines(con,1), 13))
d <- readLines(con, n=elements*2)
## remove the odd-numbered lines, they just store "length".
d <- d[ seq(from=2, by=2, length=length(d)/2...