Matrix Operations
- Building matrices. Brackets build matrices: [1 2; 3 4]: semicolons ending rows.
- Matrix versus element-wise. The star multiplies matrices; dot-star multiplies element-wise: the distinction every bug report contains.
- Concatenation. Arrays concatenate in brackets: dimensions must agree, and size() is the referee.
Indexing
- Parentheses indexing. Indexing uses parentheses: data(2, 3): one-based, row comma column.
- Colon and end. The colon slices: data(:, 1) a column, data(2:end, :) all but the first row.
- Logical indexing. Logical indexing filters by mask: data(data > 0): the question written as the answer.
Vectorised Computation
- Element-wise operators. Dot operators work element-wise on arrays: each array transformed whole, no loop written.
- Implicit expansion. Implicit expansion broadcasts compatible shapes: a row plus a column making a grid.
- sum, mean, along dims. Reductions take a dimension: sum(data, 2) across rows: direction stated, not guessed.
Before and after this level
- Before: Level 1: MATLAB Foundations: Variables and Types, Scripts, Control Flow.
- Next: Level 3: Functions: Functions, Inputs and Outputs, Reusable Numerical Programs.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does MATLAB Level 2: Matrices & Arrays cover?
Matrix Operations, Indexing, Vectorised Computation: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 1: MATLAB Foundations, which covers Variables and Types, Scripts, Control Flow.