## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### 3.2. Scalars and Vectors

A scalar is a (1 × 1) matrix containing a single element only. A column vector is a (m × 1) matrix that has m number of rows but a single column only. A row vector is a (1 × n) matrix which has n number of columns and has only one row.

#### 3.2.1. Assigning Data to Elements of a Vector/Scalar

All the elements of a row vector are separated by blank spaces or commas and are enclosed in square brackets.

For example, a row vector q = [1 2 4] can be entered at the Command Window as follows:

 q = [1 2 4]; or q = [1,2,4]

All the elements of a column vector are separated by semicolons and are enclosed in square brackets. For example, a column vector q is entered, as follows:

```q = [1; 2; 4];
```

Variable q is a column vector and has one ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required