I have a 2D matrix myMatrix of integers which I want to save its content to a text file. I did the following:
myMatrix
save myFile.txt myMatrix -ASCII >
Building on snakile's earlier answer: to write myMatrix to myFile.txt, using CR/LF as line terminator ('pc'), otherwise, you should use LF ('unix'):
dlmwrite('myFile.txt', myMatrix,'newline','pc');
To read the file into a new matrix:
newMatrix = dlmread('myFile.txt');