Programming Previous page   Next Page

Logical Indexing

A logical matrix provides a different type of array indexing in MATLAB. While most indices are numeric, indicating a certain row or column number, logical indices are positional. That is, it is the position of each 1 in the logical matrix that determines which array element is being referred to.

See Using Logicals in Array Indexing for more information on this subject.

Indexing on Assignment

When assigning values from one matrix to another matrix, you can use any of the styles of indexing covered in this section. Matrix assignment statements also have the following requirement.

In the assignment A(J,K,...) = B(M,N,...), subscripts J, K, M, N, etc. may be scalar, vector, or array, provided that all of the following are true:


Previous page  Accessing Multiple Elements Getting Information About a Matrix Next page

© 1994-2005 The MathWorks, Inc.