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

Determine Vector from Matrix

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.

Determine Vector from Scalar

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

Determine whether the scalar A is also a vector.

Character Vector and String Scalar

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

A — Input array

scalar | vector | matrix | multidimensional array

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

Algorithms

Extended Capabilities

Tall Arrays

Calculate with arrays that have more rows than fit in memory.

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

C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation

Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

HDL Code Generation

Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Thread-Based Environment

Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.

GPU Arrays

Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

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).

Distributed Arrays

Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.

This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).

Version History

Introduced before R2006a