# Various Ways To Generate Matrices In MatLab®(Illustrated Expression)

In this text, we will show you creating matrices in Matlab® in various ways. You can create Matlab® matrices according to your requirement. You can directly assign a number to matrices’ elements as separate variables. Also, you can create your matrices in one row, and also you can create your matrices by writing in matrix form in Matlab® Workspace. This is very elementary content about Matlab® but you need to start to learn Matlab coding from a very solid base.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

## How To Generate Matrices In Matlab® Various Ways?

``````>> A=[1 3 5
7 8 11
100 1 4]

A =

1     3     5
7     8    11
100     1     4

>> ``````

As you can see above, you can create a matrix by entering values according to your matrix dimensions in Matlab®. For example, a 3×3 matrix is intended then typed in this from above in Matlab®.

``````>> A=[1 3 5; 7 8 11; 100 1 4]

A =

1     3     5
7     8    11
100     1     4

>> ``````

Also, you can create your matrices in the one-row form in Matlab®. You need to put a semicolon “;” between each row of your matrix in Matlab®. Also, you need to start with “[“ and end with “]” when you are typing your matrix in Matlab®.

``````>> A(1,1)=1;
A(1,2)=3;
A(1,3)=5;
A(2,1)=7;
A(2,2)=8;
A(2,3)=11;
A(3,1)=100;
A(3,2)=1;
A(3,3)=4

A =

1     3     5
7     8    11
100     1     4

>> ``````

You can create a matrix by entering the values of elements individually as above. A(ROW NO., COLUMN NO) = X. You can create a matrix in this way. This is also useful when you need to take inputs of each element in the matrix from the user in Matlab®.

## Conclusion

Creating matrices in Matlab® in various ways is very spectacular.