Using the C Math Library    

Assigning to a Subarray 

Use two vector indices to generate a matrix destination. For example, let the vector index B = [1 2], and the vector index C = [2 3]. Then,

copies a 2-by-2 matrix into the second and third columns of rows 1 and 2: the upper right corner of A. The example matrix A becomes:

You can also use a logical matrix as an index. For example, let B be the logical matrix:

Then,

changes A to:


 Assigning to Multiple Elements Assigning to All Elements