1. Use the load file read
For example, reading the data file named 'filename.txt' is, you can use the following code:
load('filename.txt')
Note: The data should be consistent with filename.txt in the form of a matrix
2. Use the file read textread
Such as the file is read
lily 2
bob 3
joe 9
You can use the following code:
[name,age] = textread('12.txt','%s %n',2)
3. Save the file variable to the mat
save filename obj1 obj2
filename you want to save the file name, obj variable name to be saved