The setFunction in R.matlab library isn't executing properly?

code1 <- c(
  "function [y]=func(x)",
  "fprintf('its working! \n');",
  "y=x;",
  "end"
)

x<-10
setFunction(matlab,code1)
evaluate(matlab,"[y] = func(x);")
z <- getVariable(matlab,c("y"))

Error: Error in throw.default("MatlabException: ", lasterr) : MatlabException: Failed to evaluate expression '[y] = func(x);'

Version of R: 4.0.5

Version of Matlab: R2021a

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.