In previous matlab tutorial post, we have discussed about How to apply IF ELSE in MATLAB with its matlab program. Now in Post-18 of Module-01, we will discuss about how to store multiple matrix with single variable in MATLAB.

To understand this problem we are creating three matrix i.e. A, B and C and saving them in variable P. A matlab program for this problem has been shown in figure-1.

Figure.1 - MATLAB Program for saving multiple matrix with single variable.

All three matrix has been generated using the command written in line-4 to line-6 and copy it in variable P by writing a command written in line-7 to line-9. First colon ':' in P is used to select all the rows while second colon ':' in P is used to select all the columns. Third number i.e. 1, 2 and 3 is used to select the layer of matrix.

Figure.2 - Command Window output for storing multiple matrix in single variable.

Therefore matrix A is saved as first layer of matrix P. Similarly matrix B is saved as second layer of matrix P and matrix C is saved as third layer of matrix P. A message on command window has been display with the help of command written in line-10. While command written in line-11 display the matrix P on command window. Output of this matlab program has been shown in figure-2.

Output of matlab program has been called on command window by its name i.e. 'mod0118' which display that three matrix has been merged into single variable P.

Video Tutorial : How To Store Multiple Matrix into Single Variable in MATLAB.

Brought to you by INFO4EEE (Website, Channel, and Classes).

1. […] previous post on MATLAB Tutorial, we have discussed about How to store multiple matrix with single variable in MATLAB with its matlab program. Now in Post-19 of Module-01, we will discuss about how to apply WHILE […]

2. […] How to store multiple matrix with single variable in MATLAB? In this matlab tutorial, we create a program to store three matrix in single variable. […]

3. […] Read Post-18 of Module-I: How to STORE MULTIPLE MATRIX with single variable in MATLAB […]

4. […] How To STORE MULTIPLE MATRIX with Single Variable in MATLAB […]