Skip to content

Commit

Permalink
updated jvm and figure_windows arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Jul 1, 2020
1 parent 6073377 commit e14056f
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 24 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^README-.*\.png$
^cran-comments\.md$
^CONDUCT\.md$
^README\.html$
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: matlabr
Type: Package
Title: An Interface for MATLAB using System Calls
Version: 1.5.2
Date: 2018-08-13
Version: 1.6.0
Date: 2020-07-01
Authors@R: person(given = "John",
family = "Muschelli",
role = c("aut", "cre"),
Expand All @@ -17,5 +17,5 @@ License: GPL-2
Encoding: UTF-8
SystemRequirements: MATLAB
BugReports: https://github.com/muschellij2/matlabr/issues
RoxygenNote: 6.1.0
RoxygenNote: 7.1.0
Suggests: covr
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# CHANGES IN matlabr VERSION 1.6.0

- Added `jvm` and `figure_windows` arguments.

# CHANGES IN matlabr VERSION 1.5.2

- Added single threaded mode in `run_matlab_script`.
Expand Down
21 changes: 20 additions & 1 deletion R/matlab_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#' passed to \code{\link{system}} and adds the \code{-wait} flag.
#' @param single_thread Should the flag \code{-singleCompThread}
#' be executed to limit MATLAB to a single computational thread?
#' @param jvm should JVM be be loaded? If \code{FALSE}, then
#' \code{-nojvm}
#' @param figure_windows should figure windows be enabled. If
#' not, \code{-noFigureWindows} will be called
#' @export
#' @return Character of command for matlab
#' @examples
Expand All @@ -23,6 +27,8 @@ get_matlab = function(
desktop = FALSE,
splash = FALSE,
display = FALSE,
jvm = TRUE,
figure_windows = TRUE,
wait = TRUE,
single_thread = FALSE){
# find.matlab <- system("which matlab", ignore.stdout=TRUE)
Expand All @@ -41,6 +47,8 @@ get_matlab = function(
desktop = myfunc(desktop, "desktop")
splash = myfunc(splash, "splash")
display = myfunc(display, "display")
jvm = ifelse(!jvm, "-nojvm", "")
figure_windows = ifelse(!figure_windows, "-noFigureWindows", "")
wait = ifelse(
.Platform$OS.type %in% "windows",
ifelse(wait, "-wait", ""),
Expand All @@ -50,6 +58,8 @@ get_matlab = function(
wait, " ",
desktop, " ",
splash, " ",
jvm, " ",
figure_windows, " ",
ifelse(single_thread, "-singleCompThread ", ""),
display, " -r ")

Expand Down Expand Up @@ -122,6 +132,8 @@ run_matlab_script = function(
desktop = FALSE,
splash = FALSE,
display = FALSE,
jvm = TRUE,
figure_windows = TRUE,
wait = TRUE,
single_thread = FALSE,
...){
Expand All @@ -131,6 +143,8 @@ run_matlab_script = function(
splash = splash,
display = display,
wait = wait,
jvm = jvm,
figure_windows = figure_windows,
single_thread = single_thread)
cmd = paste0(' "', "try, run('", fname, "'); ",
"catch err, disp(err.message); ",
Expand Down Expand Up @@ -166,7 +180,12 @@ run_matlab_script = function(
#' paths_to_add = "~/")
#' }
#' \dontrun{
#' if (have_matlab()){
#' if (have_matlab()){
#' system.time({
#' run_matlab_code(c("disp('The version of the matlab is:')",
#' "disp(version)"), jvm = FALSE,
#' figure_windows = FALSE)
#' })
#' run_matlab_code("disp(version)")
#' run_matlab_code("disp(version)", paths_to_add = "~/")
#' run_matlab_code(c("x = 5", "disp(['The value of x is ', num2str(x)])"))
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
output: github_document
output: github_document
---

[![Travis build status](https://travis-ci.org/muschellij2/matlabr.svg?branch=master)](https://travis-ci.org/muschellij2/matlabr)
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@

[![Travis build status](https://travis-ci.org/muschellij2/matlabr.svg?branch=master)](https://travis-ci.org/muschellij2/matlabr) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/muschellij2/matlabr?branch=master&svg=true)](https://ci.appveyor.com/project/muschellij2/matlabr) [![Coverage status](https://coveralls.io/repos/github/muschellij2/matlabr/badge.svg?branch=master)](https://coveralls.io/r/muschellij2/matlabr?branch=master) [![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/matlabr)](https://cran.R-project.org/package=matlabr) [![Downloads](https://cranlogs.r-pkg.org/badges/matlabr)](https://cran.R-project.org/package=matlabr)
[![Travis build
status](https://travis-ci.org/muschellij2/matlabr.svg?branch=master)](https://travis-ci.org/muschellij2/matlabr)
[![AppVeyor Build
Status](https://ci.appveyor.com/api/projects/status/github/muschellij2/matlabr?branch=master&svg=true)](https://ci.appveyor.com/project/muschellij2/matlabr)
[![Coverage
status](https://coveralls.io/repos/github/muschellij2/matlabr/badge.svg?branch=master)](https://coveralls.io/r/muschellij2/matlabr?branch=master)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/matlabr)](https://cran.R-project.org/package=matlabr)
[![Downloads](https://cranlogs.r-pkg.org/badges/matlabr)](https://cran.R-project.org/package=matlabr)

<!-- README.md is generated from README.Rmd. Please edit that file -->
matlabr Package:
================

`matlabr` is an R package to call MATLAB directly using `system` command. This is a simple package that tries to get around using `R.matlab` and a MATLAB server.
# matlabr Package:

Installation
------------
`matlabr` is an R package to call MATLAB directly using `system`
command. This is a simple package that tries to get around using
`R.matlab` and a MATLAB server.

You can install the stable version on [CRAN](https://cran.R-project.org/package=matlabr):
## Installation

You can install the stable version on
[CRAN](https://cran.R-project.org/package=matlabr):

``` r
install.packages('matlabr', dependencies = TRUE)
Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Test environments
* local OS X install, R 3.5.1
* ubuntu 14.04 (on travis-ci), R 3.5.1
* win-builder (devel and release)
* local R installation, R 4.0.0
* ubuntu 16.04 (on travis-ci), R 4.0.0
* win-builder (devel)

## R CMD check results

Expand Down
18 changes: 16 additions & 2 deletions man/get_matlab.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions man/run_matlab_code.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions man/run_matlab_script.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion matlabr.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
PackageRoxygenize: rd,collate,namespace,vignette

0 comments on commit e14056f

Please sign in to comment.