Many of the functions we have used to import data into MATLAB have a corresponding function that allows us to export data. At the beginning of the chapter, we learned to save our data for later use with the save command:
>> save filename.mat
Remember, this command saves all contents of the workspace in a compressed file with a .mat extension, called a MAT-file.
The dlmread() function allows us to handle text files with a specified delimiter. We can use this function to write a matrix to an ASCII-delimited file. To test the function, we start from a matrix of random numbers:
>> MyMatrix = rand(5)
MyMatrix =
0.7577 0.7060 0.8235 0.4387 0.4898
0.7431 0.0318 0.6948 0.3816 0.4456
0.3922 0.2769 0.3171 0.7655 0.6463
0.6555 0.0462 0.9502 0.7952 0.7094
0.1712 0.0971...