Matlab - colon Flashcards
what does a colon mean when you use it in round brackets
it means everything in a row or column and is normally used to extract data from a matrix
what would E( : , 2 ) mean
everything in COLUMN 2 of E
if the matrix is
E = 1 2 10
4 5 6
7 8 9
what would
» E(:,2) print?
ans = 2
5
8
what would E(2,:) mean?
every column in ROW 2 of E
if the matrix is
E = 1 2 10
4 5 6
7 8 9
what would»_space; E(2,:) print?
ans = 4 5 6
what does this mean E(:)
it would rearrange everything in E into one long column
what does a colon mean between two numbers
it means to count from A to B one integer at a time
what would this command print?
F = 5:10
F = 5 6 7 8 9 10
what does this mean F(:,3:5)
from matrix F, everything in columns 3, 4 and 5
what does a set of three numbers mean when using two colons? example: G = 3:4:20
the middle number specifies in what increments to count from A to B.
from example: ans = 3 7 11 15 19