Connexions

You are here: Home » Content » Vectors and Arrays in MATLAB

Recently Viewed

This feature requires Javascript to be enabled.

Vectors and Arrays in MATLAB

Module by: Darryl Morrell. E-mail the author

Summary: This module provides a link to the Mathworks tutorial on MATLAB vectors and arrays, and adds a useful piece of information not covered in the tutorial.

Note: You are viewing an old version of this document. The latest version is available here.

Vectors and Arrays in MATLAB

An excellent tutorial on how to use MATLAB's vector and array capabilities is at the Mathworks MATLAB tutorial page.

One useful method of accessing entire rows or entire columns of the matrix is not mentioned in the tutorial. Suppose that the matrix A is defined as


>> A = [1  2  3  4  5
6  7  8  9  10
11 12 13 14 15
16 17 18 19 20]
A =

1  2  3  4  5
6  7  8  9  10
11 12 13 14 15
16 17 18 19 20


An entire row of A can be obtained by specifying a single ":" as the column index:

>> A(2,:)

ans =

6  7  8  9  10


Similarly, an entire column of A can be obtained by specifying a single ":" as the row index:

>> A(:,3)

ans =

3
8
13
18



Content actions

Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks