MATLAB: Save matrix….load matrix

load matrixsave matrix

A =
2 3 4
5 6 7
8 8 9
how can i save the matrix A to a file (txt or mat)? And then load it and have
C=…something…
and in matlab it will appear
C =
2 3 4
5 6 7
8 8 9
thank you…

Best Answer

You can save the variable as a mat file using something like this:
save('saveA.mat','A');
To do the second step, you can create a matfile object like;
example = matfile('saveA.mat');
C = example.A;