This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create Vectors

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Vectors in MuPAD® do not form a separate data type. As matrices, vectors belong to the type Dom::Matrix(). To create a row or a column vector, use the matrix command and specify one of the dimensions to be 1. For example, create a row vector that contains five elements:

matrix(1, 5, [1, 2, 3, 4, 5])

Now, create a column vector of five elements:

matrix(5, 1, [1, 2, 3, 4, 5])

If you do not specify the dimensions, the matrix command creates a column vector:

matrix([x, y, z])

Was this topic helpful?