MATLAB: How to save the output of a Maple command for subsequent usage in the Symbolic Math Toolbox 3.2.3 (R2008a)

minimaxSymbolic Math Toolbox

I am calling the 'minimax' Maple function using the MAPLE command in the Symbolic Math toolbox as follows:
result = maple('minimax(x -> exp(x), 0..1, [3,3], x -> 1/exp(x), ''maxerror'')')
The MAPLE function returns the following string in variable 'result':
result =
f := x -> (1.2602800445888353170924366790497+(.66158210209444427227482310507910+(.14246093837255028787615147350931+.13527434224563229808331124195992e-1*x)*x)*x)/(1.2602800461150506916370546709863+(-.59869809320400732192202261234153+(.11102133762163519871251090606741-.82048035877127366183518546907472e-2*x)*x)*x)
I would like to be able to retrieve the symbolic result of the call to 'minimax' in Maple and evaluate the resulting rational polynomial function in MATLAB without resorting to a cut-and-paste operation.

Best Answer

The Maple commands specified when calling the MAPLE function are evaluated in the Maple kernel and a text string equivalent of the resulting output is returned to MATLAB. To reuse the output in MATLAB, this string will have to be parsed and evaluated in MATLAB or evaluated in Maple using the MAPLE function.
Alternatively, you could assign the output of the Maple function 'minimax' to a function variable stored in the Maple kernel. This function can be subsequently evaluated in Maple by passing input parameters using the MAPLE function. The final numerical output can then be converted into a MATLAB double, as follows:
maple('f := minimax(x -> exp(x), 0..1, [3,3], x -> 1/exp(x), ''maxerror'')');
y = maple('f(4)');
y = str2num(y);
For more information on the MAPLE function, please consult the Symbolic Math Toolbox documentation by executing the following at the MATLAB command prompt:
doc maple