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.


Number of components of a vector

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.




linalg::vecdim(v) returns the number of elements of the vector .


Example 1

We define a column vector with two elements and a row vector with four elements:

v1 := matrix([1, 0]); v2 := matrix([[1, 2, 3, 4]])

linalg::vecdim gives us the number of elements, i.e., the dimension of these vectors:

linalg::vecdim(v1), linalg::vecdim(v2)

In contrast, the function linalg::matdim returns the number of rows and columns of these vectors:

linalg::matdim(v1), linalg::matdim(v2)



A vector, i.e., an n×1 or 1 ×n matrix of a domain of category Cat::Matrix

Return Values

Positive integer.

See Also

MuPAD Functions

Was this topic helpful?