Is there a function similar to matlabFunction()
of MATLAB? Or how to do this in R
?
The function in MATLAB.
syms x
dados = inputdlg({'P(x): ', 'Q(x): ', 'R(x): ', 'N: '},'Dados');
P = matlabFunction(sym(dados{1}),'vars',x,'file','px');
In R
I'm trying to do it like this:
P <- function(x){
expr = dados[1]
y <- eval(parse(text= expr), list(x))
return (y)
}
But I still have to change the expression inside the function or pass it by parameter.