# 行列と配列の作成

この例では、MATLAB を使用して配列と行列を作成する基本的な手法を説明します。行列と配列は、MATLAB における情報とデータの基本的な表現です。

```disp('Create an array with four elements in a single row:') disp('>> a = [1 2 3 4]') a = [1 2 3 4] ```
```Create an array with four elements in a single row: >> a = [1 2 3 4] a = 1 2 3 4 ```

```disp('Create an array with four elements in a single column:') disp('>> a = [1; 2; 3; 4]') a = [1; 2; 3; 4] ```
```Create an array with four elements in a single column: >> a = [1; 2; 3; 4] a = 1 2 3 4 ```

```disp('Create a matrix with three rows and three columns:') disp('>> a = [1 2 3; 4 5 6; 7 8 9]') a = [1 2 3; 4 5 6; 7 8 9] ```
```Create a matrix with three rows and three columns: >> a = [1 2 3; 4 5 6; 7 8 9] a = 1 2 3 4 5 6 7 8 9 ```

```disp('Create an array that starts at 1, ends at 9, with each element separated by 2:') disp('>> x = 1:2:9') x = 1:2:9 ```
```Create an array that starts at 1, ends at 9, with each element separated by 2: >> x = 1:2:9 x = 1 3 5 7 9 ```

```disp('Create a 1-by-5 matrix of 0''s:') disp('>> z = zeros(1, 5)') z = zeros(1, 5) ```
```Create a 1-by-5 matrix of 0's: >> z = zeros(1, 5) z = 0 0 0 0 0 ```