Question: Access Matlab workspace in Maple

Hi there, I'm trying to pass some calculation to Matlab then retrive the result by getvar(), but seems something is getting wrong.

my matlab function is very simple:

 

function out =maple_fun(a, b)

out = a + b;

return

 

this function is saved as maple_fun.m.

 

in Maple,

restart:
with(Matlab):
openlink():
DirectoryLocation := " cd  '/Users/Kyle/Documents/MATLAB/'  ":
evalM(DirectoryLocation):
evalM("which maple_fun.m");
>> /Users/Kyle/Documents/MATLAB/maple_fun.m


evalM("result = maple_fun(2, 3)");
getvar(" result ");
Error, (in Matlab:-getvar) GetVariable, Matlab cannot get array!

so how can I get the matlab result??

 

thanks

Kyle

Please Wait...