dimensions - Maple Help

Matlab

 dimensions
 compute the dimensions of a MapleMatrix or MatlabMatrix using Maple

 Calling Sequence dimensions(X)

Parameters

 X - MapleMatrix, or MatlabMatrix

Description

 • The command dimensions computes the size of a matrix. This command is equivalent to the Matlab[size] command.
 • Use dimensions for computing dimensions of Maple variables, and Matlab[size] for computing the dimensions of MATLAB® variables.
 • If X is a string, then the size is computed using MATLAB®.
 • Executing the dimensions command returns an integer list with n elements for an n-dimensional object. For example, a 3x4 matrix is two-dimensional, therefore a list with two elements is returned. Each element corresponds to the size of that dimension. For the 3x4 matrix, the returned list is [3, 4].

Examples

Setting two Maple matrices.

 > $\mathrm{with}\left(\mathrm{Matlab}\right):$
 > $\mathrm{maplematrix_a}≔\mathrm{Matrix}\left(\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 dimensions of these matrices in Maple are 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{setvar}\left("matlabmatrix_a",\mathrm{maplematrix_a}\right)$
 > $\mathrm{setvar}\left("matlabmatrix_b",\mathrm{maplematrix_b}\right)$

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

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

 [2, 2]