Matlab Basics
To open Matlab, type matlab at the command line prompt.
The box on the right is your command window.
The upper-left box lists the variables currently in memory.
The lower-left box lists the commands you recently typed.
A Few Basic Commands
Type the following in your command window (or cut and paste).
% The words after `%' are comments and explanations % They will not affect the commands and do not need to be typed in A = [1 2 3] % the variable list now shows a 1x3 matrixPush the up arrow and add a semi-colon to the previous command. This tells Matlab to not echo the results to the command window. This is useful when operating on large matrices.
A * 4 % basic math is very simple in Matlab- just type the expression as you would write it B = A * 4 % assignment to a new variable C = [0:6; 0:6] % creates a 2x7 matrix % a colon between two numbers will be a single count array % a semicolon inside the brackets indicates a new row clear A B % clears the variables 'A' and 'B' from the desktop % clear by itself will clear all variables C = [0:.2:6; 0:.2:6] % the rows in the matrix step by .2, instead of 1 % a negative step can also be used C(1,1) % element in row 1, column 1 C(:,end-2:end) % elements in all rows (1:2), columns 29 to 31