Previously, we've already seen some of these. In particular, we worked with the load() and save() functions to load and save workspace data using command-line functions. Let's review these functions:
>> save filename.mat
>> load filename.mat
Recall that these functions operate on .mat files but can also be used with ASCII text files.
We've just seen how to upload a .mat file, which we remember represents a specific format to save the contents of the workspace. Let's now take a look at how to load ASCII text files. For this purpose, we can use different functions depending on the kind of delimiter (a character used to separate values) in the text files. If the numeric entries are separated by blank space, comma, semicolon, or tab, then the load() function can be used. Let's try it with an example. Suppose we have a text file named matrix.txt in the following form:
10 20 30
40 50 60
70 80 90
To import such data as a MATLAB matrix, we will write:
>> load matrix.txt
>> matrix
matrix =
10 20 30
40 50 60
70 80 90
>>