| Getting Started | ![]() |
The find Function
The find function determines the indices of array elements that meet a given logical condition. In its simplest form, find returns a column vector of indices. Transpose that vector to obtain a row vector of indices. For example,
picks out the locations, using one-dimensional indexing, of the primes in the magic square.
Display those primes, as a row vector in the order determined by k, with
When you use k as a left-hand-side index in an assignment statement, the matrix structure is preserved.
| Logical Subscripting | Controlling Command Window Input and Output | ![]() |