isvector - Determine whether input is vector - MATLAB (original) (raw)

Main Content

Determine whether input is vector

Syntax

Description

TF = isvector([A](#mw%5F2deef8b0-27fc-4e3f-aa6a-d416130d5f26)) returns logical1 (true) if A is a vector. Otherwise, it returns logical 0 (false). A vector is a two-dimensional array that has a size of 1-by-N or N-by-1, where N is a nonnegative integer.

example

Examples

collapse all

Create a 2-by-2 matrix. Determine whether it is a vector.

A = [1 2; 3 4]; TF = isvector(A)

Check whether the first column of the matrix is a vector.

Check whether the first row of the matrix is a vector.

Create a scalar, which is a 1-by-1 array.

Determine whether the scalar A is also a vector.

Create an array of characters. Determine whether it is a vector.

A = 'Hello, World!'; TF = isvector(A)

Check the dimension of A using size. A is a 1-by-13 character vector.

Now create a string scalar by enclosing a piece of text in double quotes.

Check whether the scalar A is also a vector.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.

Algorithms

Extended Capabilities

expand all

Theisvector function fully supports tall arrays. For more information, see Tall Arrays.

The isvector function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced before R2006a