matrix to Matrix - Maple Help

convert/Matrix

convert an array, Array, vector, Vector, matrix, Matrix or list to a Matrix

 Calling Sequence convert( A, Matrix, opts );

Parameters

 A - array, Array, vector, Vector, matrix, Matrix, string, list; expression to convert opts - (optional) one or more options as described below

Options

 • copy : truefalse
 Indicates whether a new rtable should be allocated when converting from other rtable types such as Array or Vector. The default is false, meaning that convert will attempt to provide a reference to the existing rtable instead of allocating a new one.
 • format : string
 A string corresponding to one of the file formats described in Formats. The input expr will be decoded using the specified format and the data returned as a Matrix. If the format specified is not one for which a Matrix is a valid output type, an error is issued.
 • sourceformat : string
 A synonym for the option format for consistency with other convert subroutines.
 • Any other options specified will be passed to the Matrix constructor.

Description

 • The convert(A, Matrix) function converts A into a Matrix. This is accomplished by simply passing A and any additional parameters to the Matrix constructor.

Examples

 > $A≔\left[\left[1,2\right],\left[3,4\right]\right]$
 ${A}{≔}\left[\left[{1}{,}{2}\right]{,}\left[{3}{,}{4}\right]\right]$ (1)
 > $\mathrm{A1}≔\mathrm{convert}\left(A,\mathrm{Matrix}\right)$
 ${\mathrm{A1}}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (2)
 > $\mathrm{type}\left(A,\mathrm{Matrix}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left(\mathrm{A1},\mathrm{Matrix}\right)$
 ${\mathrm{true}}$ (4)
 > $M≔\mathrm{matrix}\left(3,3,\left[\left[1,1,1\right],\left[1,2,3\right],\left[7,8,9\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{1}& {1}& {1}\\ {1}& {2}& {3}\\ {7}& {8}& {9}\end{array}\right]$ (5)
 > $\mathrm{M1}≔\mathrm{convert}\left(M,\mathrm{Matrix},\mathrm{datatype}=\mathrm{float}\right)$
 ${\mathrm{M1}}{≔}\left[\begin{array}{ccc}{1.}& {1.}& {1.}\\ {1.}& {2.}& {3.}\\ {7.}& {8.}& {9.}\end{array}\right]$ (6)
 > $\mathrm{type}\left(M,\mathrm{Matrix}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(\mathrm{M1},\mathrm{Matrix}\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{convert}\left("1,2,3 4,5,6 7,8,9",\mathrm{Matrix},\mathrm{sourceformat}="CSV"\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {3}\\ {4}& {5}& {6}\\ {7}& {8}& {9}\end{array}\right]$ (9)

Compatibility

 • The convert/Matrix command was updated in Maple 2022.
 • The copy, format and sourceformat options were introduced in Maple 2022.