size - Maple Help

Matlab

 size
 compute the size of a MapleMatrix or MatlabMatrix using MATLAB(R)

 Calling Sequence size(X)

Parameters

 X - MapleMatrix, or MatlabMatrix

Description

 • The size command computes the size of a matrix using MATLAB®.
 • Executing the size command returns an integer list with n elements for an n-dimensional object.  For example, a three-by-four matrix is two-dimensional, and returns a list with two elements. Each element represents the size of the corresponding dimension. The three-by-four matrix returns the list [3, 4].
 • To compute the size of a Maple variable, you should use Matlab[dimensions]. Calling size when X is a Maple variable causes X to be copied into the MATLAB® memory space before the MATLAB® size command is called. If X is already a MATLAB® variable (that is, X is a string), then the size is immediately and efficiently computed.

Examples

Setting two Maple matrices.

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

The size of these matrices in Maple is computed as

 > $\mathrm{Matlab}\left[\mathrm{dimensions}\right]\left(\mathrm{maplematrix_a}\right)$

 [2, 3]

 > $\mathrm{Matlab}\left[\mathrm{dimensions}\right]\left(\mathrm{maplematrix_b}\right)$

 [3, 2]

The matrices are set in the MATLAB® session

 > $\mathrm{Matlab}\left[\mathrm{setvar}\right]\left("matlabmatrix_a",\mathrm{maplematrix_a}\right)$
 > $\mathrm{Matlab}\left[\mathrm{setvar}\right]\left("matlabmatrix_b",\mathrm{maplematrix_b}\right)$
 > $\mathrm{Matlab}\left[\mathrm{size}\right]\left(\mathrm{maplematrix_a}\right)$

 [2, 3]

 > $\mathrm{Matlab}\left[\mathrm{size}\right]\left(\mathrm{maplematrix_b}\right)$

 [3, 2]

The product of maplematrix_a*maplematrix_b is computed in MATLAB® and the result is assigned to matlabmatrix_c. The size of the new matrix is determined with the Maple call.

 > $\mathrm{Matlab}\left[\mathrm{evalM}\right]\left("matlabmatrix_c=matlabmatrix_a*matlabmatrix_b"\right)$
 > $\mathrm{Matlab}\left[\mathrm{size}\right]\left("matlabmatrix_c"\right)$

 [2, 2]