Search code examples
matlabmat

Read from .mat file


working with MATLAB, I have a Matrix M, I want to save it in a .mat file then import it and reuse it in my code. I have tried:

save ('file1.mat','M')
MSaved=load('file1.mat');

Name   | Size    | Bytes | Class  | Attributes
-------+---------+-------+--------+-----------
MSaved | 4215x20 | 40744 | double |

How can I get access to each cell of the matrix? How to save it again in a matrix?

Need some help, thanks in advance.


Solution

  • The load function will return a structure containing all the saved variables. So your matrix is MSaved.M