evalM - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Matlab

 evalM
 evaluate a MATLAB(R) expression using MATLAB(R)

 Calling Sequence evalM('string')

Parameters

 string - string defining the operation in MATLAB®

Description

 • The evalM command uses MATLAB® to evaluate an expression constructed with MATLAB® syntax.
 • Matlab[evalM] does not return the result of the evaluation. To capture the result, preface the expression with a MATLAB® variable name. For example, to multiply matrices A and B, use the command Matlab[evalM]("C=A*B"), followed by Matlab[getvar]("C"). Ensure that A and B are already defined in MATLAB®.
 • If an error occurs during the evaluation of the expression, Maple returns a generic error message. Since Maple cannot obtain strings from MATLAB®, there is no way for Maple to determine the specific cause of the error.  If you want to determine the cause of the error, switch to an open MATLAB® window (if possible) and enter the LASTERR command.
 • Executing the evalM command returns a null.

Examples

 > $\mathrm{with}\left(\mathrm{Matlab}\right):$
 > $\mathrm{maplematrix_a}≔\mathrm{Matrix}\left(\left[\left[3,3,2\right],\left[4,5,2\right],\left[6,2,4\right]\right]\right)$
 ${\mathrm{maplematrix_a}}{≔}\left[\begin{array}{ccc}{3}& {3}& {2}\\ {4}& {5}& {2}\\ {6}& {2}& {4}\end{array}\right]$ (1)
 > $\mathrm{maplematrix_b}≔\mathrm{Matrix}\left(\left[\left[3,2,5\right],\left[1,8,2\right],\left[7,3,4\right]\right]\right)$
 ${\mathrm{maplematrix_b}}{≔}\left[\begin{array}{ccc}{3}& {2}& {5}\\ {1}& {8}& {2}\\ {7}& {3}& {4}\end{array}\right]$ (2)
 > ${\mathrm{Matlab}}_{\mathrm{setvar}}\left("matlabmatrix_a",\mathrm{maplematrix_a}\right)$
 > ${\mathrm{Matlab}}_{\mathrm{setvar}}\left("matlabmatrix_b",\mathrm{maplematrix_b}\right)$

These expressions can be manipulated and operated on in MATLAB®.

 > ${\mathrm{Matlab}}_{\mathrm{evalM}}\left("c=inv\left(matlabmatrix_b\right)*matlabmatrix_a\text{'}"\right)$
 > ${\mathrm{Matlab}}_{\mathrm{getvar}}\left("c"\right)$

 [-0.161676646706586879 , -0.401197604790419215 , -0.155688622754491135] [                                                                     ] [0.245508982035928164 ,  0.461077844311377216 , -0.0598802395209581256] [                                                                     ] [0.598802395209580895 ,   0.856287425149700686 ,   1.31736526946107802]