Nothing, but vectors in 2D.
A = [1, 2, 3; 2, 3, 5; 1, 1, 2] % commas separate horizontally, semicolons vertically
A = [1:5; 2:6; 3:7] % semicolons to separate rows
A = [(1:5)', (2:6)', (3:7)'] % commas to separate columns
v1 = [1, 2, 3];
v2 = 1:3;
v3 = linspace(1, 3, 3);
A = [v1; v2; v3]
Most people use in-built functions for $\texttt{zeros, ones, rand}$ creating matrices
A1 = zeros(4, 4)
A2 = ones(2, 3)
A3 = rand(5, 2)
A4 = ones(5) % be careful, this will create a matrix 5x5, not a vector
v = ones(1, 10) % set one dimension to 1 for a vector
Just like vectors, but now provide two indices
A = [1, 2, 3; 4, 5, 6; 7, 8, 9]
A(2, 1) % second row, first column (rows always go first)
A(2, 1:3) % select an entire second row
A(2, 1:end) % select an entire second row
A(2, :) % select an entire second row
You can use linear indices (providing only one index), it will select elements from a matrix one by one going columns frist, so
A(1)
A(2)
A(3)
A(4)
A(5)
A(6)
A(7)
A(8)
A(9) % normally don't write code like this, use a for loop (lecture 2)
Nothing, but vectors of characters
'a' % a character
'abc' % a vector of characters, always use single quotes ' '
greeting = 'Hello World!'
You can form matrices of strings (vectors of characters), but that's usually a bad idea, since the matrix dimensions have to match.
M = [greeting; greeting]
new_greeting = 'Hi!';
M = [new_greeting; greeting]; % this gives an error in matlab, octave adds spaces after 'Hi!' to make dimensions work
Lists for everything whatsoever, a much better idea when storing multiple strings together (don't use matrices/vectors for strings).
Cell arrays are formed and accessed like normal vectors (or matrices), but all parenthesis become curly braces.
c = {'Hi', 2, 'you', [pi, 2; 4, 5]}
c = {2, 3; 4, 6} % two dimensional cell array (notice the semicolon)
c = cell(1, 5) % you can create empty cell arrays with cell(rows, columns)
help abs % for quick reference
Google 'matlab
Matlab has an amazing documentation online.
Alternatively, launch the docs from the program.
$\verb|doc <function>|$