Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to link gmwmx R-package with matlab #1

Closed
kermarrecg opened this issue Nov 22, 2022 · 1 comment
Closed

How to link gmwmx R-package with matlab #1

kermarrecg opened this issue Nov 22, 2022 · 1 comment

Comments

@kermarrecg
Copy link

kermarrecg commented Nov 22, 2022

You are working with Matlab and want to link your workspace with gmwmx?
Here is the procedure to follow:

  1. Download the R package Rcall: https://github.com/kreutz-lab/Rcall
  2. Add the Rcall folder to the Matlab path.
  3. In your Matlab environment, use the following command:
    Rclear
    Rinit([],'/usr/bin/R'); %your path to R.exe (type which R for linux user, where R for windows)
    Rinit('gmwmx')
    filepath = 'filepathwiththedatatoanalyse'
    Rpush('filepath',filepath)
    Rrun('data_dobs <- read.gnssts(filename = filepath)')
    Rrun('fit <- estimate_gmwmx(x = data_dobs, theta_0 = c(0.01,0.1,1.3),model_string = "matern", n_seasonal=0)')

Then extract only the information you are interested in, for instance:

Rrun('beta <- fit$beta_hat')
Rrun('theta <- fit$theta_hat')
and finally:

[beta,theta] = Rpull('beta','theta');

You have now beta and theta in your Matlab environment. For further information and example: https://github.com/kreutz-lab/Rcall/wiki
Rcall can be used in any Matlab script. Using Rcall involves passing all necessary data to R, performing computations according to the user input, and sending the results back to Matlab for further use.

@lionelvoirol
Copy link
Member

Great. Thanks. 👍 . Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants