Opening the book…
Once a matrix is created, we often do not want the entire matrix. We might want one row, one column, or a smaller section. MATLAB makes this easy with indexing and the colon operator.
Extracting a block of data.
Solution
The colon symbol means "all" in this context. So mat2(1,:) means row 1 and all columns. Similarly, mat2(:,3) means all rows and column 3.
data_1 =
2 10 5
data_2 =
5
17
0
data_3 =
6 20
13 2
This page titled 4.4: Extracting Rows, Columns, and Subarrays was last modified on Tue, 30 Jun 2026 02:11:56 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.