Integrating MATLAB Scripts in the R Markdown Document

I would like to combine some old matlab scripts into a .Rmd document for my dissertation, to avoid copying, which knitr is trying to avoid anyway. Is it possible? Using http://yihui.name/knitr/demo/engines/ I managed to integrate python code without any problems, but Matlab is much more complicated.

+6
source share
2 answers

knitr updated, and the current version 1.15.1 allows the use of more supported engines: an octave is one of them:

 library(knitr) names(knit_engines$get()) [1] "awk" "bash" "coffee" "gawk" "groovy" [6] "haskell" "lein" "mysql" "node" "octave" [11] "perl" "psql" "python" "Rscript" "ruby" [16] "sas" "scala" "sed" "sh" "stata" [21] "zsh" "highlight" "Rcpp" "tikz" "dot" [26] "c" "fortran" "fortran95" "asy" "cat" [31] "asis" "stan" "block" "block2" "js" [36] "css" "sql" 

To add an octave code in a Rmarkdown laptop, use

 ```{octave} # Insert your octave code here ``` 
+5
source

The currently supported knitr engines are

 > require(knitr); names(knit_engines$get()) [1] "awk" "bash" "coffee" "gawk" "haskell" "perl" "python" "Rscript" "ruby" "sas" [11] "sed" "sh" "zsh" "highlight" "Rcpp" "tikz" "dot" "c" "asy" "cat" 

So matlab is not currently supported as a knitr mechanism, but it is possible ( Convert MATLAB code to R ) to help port MATLAB code to R

+3
source

All Articles