# Difference between revisions of "MatlabIntro"

From CCRMA Wiki

(→General tips) |
|||

Line 1: | Line 1: | ||

[[Category:MATLAB]] | [[Category:MATLAB]] | ||

− | Use square brackets to define a vector/matrix | + | == Basics == |

+ | |||

+ | * Use semi-colon at the end of the line to prevent the output of the operation to be printed to the screen | ||

+ | |||

+ | <pre> | ||

+ | >> x = [1 2 3 4 5] | ||

+ | |||

+ | x = | ||

+ | |||

+ | 1 2 3 4 5 | ||

+ | </pre> | ||

+ | |||

+ | vs. | ||

+ | |||

+ | <pre> | ||

+ | >> x = [1 2 3 4 5]; | ||

+ | >> | ||

+ | </pre> | ||

+ | |||

+ | |||

+ | === Vector and Matrices === | ||

+ | |||

+ | * Use square brackets to define a vector/matrix | ||

<code> | <code> |

## Revision as of 10:42, 21 September 2010

## Basics

- Use semi-colon at the end of the line to prevent the output of the operation to be printed to the screen

>> x = [1 2 3 4 5] x = 1 2 3 4 5

vs.

>> x = [1 2 3 4 5]; >>

### Vector and Matrices

- Use square brackets to define a vector/matrix

```
x = [1 2 3 4 5]
```

## General tips

- Try to vectorize every operation if you can