2.5.7 - Creating a sub-matrix
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Write the command to extract rows 1 and 2 from matrix A.
💡 Hint: Use brackets to specify row indices.
What does A(:, 1) return for matrix A?
💡 Hint: Remember the colon operator selects all rows.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the syntax to create a sub-matrix from rows 1 and 3, and columns 2?
💡 Hint: Look for the correct use of list syntax for indices.
True or False: You can use a colon operator to reference all elements in a column.
💡 Hint: Consider how data selection works in sections.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Given matrix D = [3 1 4; 1 5 9; 2 6 5], write code to create a sub-matrix that includes all rows but only the first two columns.
💡 Hint: Focus on how to include all rows and only apply a range to the columns.
If you have a matrix E = [1 2 3; 4 5 6; 7 8 9; 10 11 12], how would you extract a sub-matrix containing rows 3 to 4 and columns 1 to 2?
💡 Hint: Identify which rows to select and which columns to slice from.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.