>> homeCol = 8;
An array can be a list of numbers and is created by
>> locRows = [6;2;8];
enclosing the list in square brackets and separating the >> locCols = [5;7;2];
elements with semicolons.
You can create a cell array to hold words using curly >> locNames =
braces. {'Mall','Movies','Cafe'};
>> homeRow = 4
Variable names are entered on the left, followed by the equals homeRow =
sign, then the value to assign the variable. 4
>> locName = 'Mall'
If the variable contains letters, enclose it in single quotation locName =
marks. Mall
>> homeRow
You can print out the variable value in the Command Window homeRow =
by typing just its name. 4
>> homeRow = 4;
>> homeCol = 8;
You can suppress the output from being printed on the >> locRow = 6;
Command Window by ending the command with a semicolon. >> locCol = 5;
>> locName = 'Mall';
>> distRow =
abs(homeRow - locRow);
>> distCol =
You can perform math using variables. abs(homeCol - locCol);
>> distTotal = distRow
+ distCol;
Remember that you can use the up arrow, , to recall previous commands.