Getting Started |

**Entering Matrices**

The best way for you to get started with MATLAB is to learn how to handle matrices. Start MATLAB and follow along with each example.

You can enter matrices into MATLAB in several different ways:

- Enter an explicit list of elements.
- Load matrices from external data files.
- Generate matrices using built-in functions.
- Create matrices with your own functions in M-files.

Start by entering Dürer's matrix as a list of its elements. You only have to follow a few basic conventions:

- Separate the elements of a row with blanks or commas.
- Use a semicolon,
`;`

, to indicate the end of each row. - Surround the entire list of elements with square brackets,
`[ ]`

.

To enter Dürer's matrix, simply type in the Command Window

MATLAB displays the matrix you just entered.

This exactly matches the numbers in the engraving. Once you have entered the matrix, it is automatically remembered in the MATLAB workspace. You can refer to it simply as `A`

. Now that you have `A`

in the workspace, take a look at what makes it so interesting. Why is it magic?

Matrices and Magic Squares | sum, transpose, and diag |