Learn R Programming

matlabr (version 1.1.3)

run_matlab_code: Runs matlab code

Description

This function takes in matlab code, where the last line must end with a ;, and returns the exit status

Usage

run_matlab_code(code, endlines = TRUE, verbose = TRUE,
  add_clear_all = FALSE, ...)

Arguments

code

Character vector of code.

endlines

Logical of whether the semicolon (;) should be pasted to each element of the vector.

verbose

Print out filename to run

add_clear_all

Add clear all; to the beginning of code

...

Options passed to run_matlab_script

Value

Exit status of matlab code

Examples

Run this code
# NOT RUN {
if (have_matlab()){
   run_matlab_code("disp(version)")
   run_matlab_code(c("disp('The version of the matlab is:')", "disp(version)"))
   run_matlab_code(c("x = 5", "disp(['The value of x is ', num2str(x)])"))
}
# }

Run the code above in your browser using DataLab