Learn R Programming

RcppOctave (version 0.18.1)

as.mfile: M Files

Description

as.mfile converts source code or .m filenames into real paths to .m files that can be sourced with o_source.

Usage

as.mfile(..., pattern = "mfile_", dir = tempdir())

Arguments

...
specification of a .m files as character arguments. The elements of the vector can be either file paths or plain Octave/Matlab code, which are then written to disk in -- temporary -- .m files. Note that the paths do not need to correspond to existing files.
pattern
a non-empty character vector giving the initial part of the name.
dir
existing directory where to write the .m files generated from the plain code elements of x.

Examples

Run this code


f <- as.mfile('test.m')
f

# detected code elements are written into temporary files
f <- as.mfile('test.m', "function [y] = myfun()
y = 1;
end
")

## Not run: 
# file.show(f[2])
# ## End(Not run)

# remove all files
unlink(f)

Run the code above in your browser using DataLab