We use MATLAB in the process, inevitably hope that the operation will be in the process of some data "storage" with a view to the next use of "read" use. "Save" and "reading" the instructions are load and save, and save the data types are divided into: (1) Dual-bit format (binary format) MAT-file, (2) ASCII format ASCII - file. MAT-file is double-bit characters stored in the computer can read / income (input / output) rates accelerate, its format for test.mat (test for the file name), MATLAB will be the default file type for MAT - file and the file is ASCII-characters are identifiable storage, but will be reduced in the computer read / income rate, its format test.dat (test for the stalls). If your data is only produced in MATLAB and use, it would be preferable to use MAT-file. ASCII-file must be used in the data files for other application software MATLAB not read when.
Also we should pay attention to, when save-MAT file is stored variables themselves, rather than direct storage of data variables, and save the file into ASCII is the numerical variables stored directly.
This difference between the two stocks, resulting in read MAT ASCII files and the data files vary, as detailed in the following example.
It should be noted that in the store and read data, MAT-file or ASCII file-stall pattern matrix for the best, the reader might otherwise have difficulties. Data storage can be the size of a matrix for m × n, m is the number of series, n is the number of firms.
The following are a few save, load example of the use of
>> X = 1:5; y = 11.15;% to a two out Array (row array) x, y
>>% Save data1 xy is the x, y values into two variables data1 this MAT-file,
% Data1.mat fact that data1. Data1.mat the contents of the variable x, y, instead of (1:50, 11:15) Data
>> Save data2.dat xy-ascii% If you want to change data1 stored in ASCII format, they add - ascii
% Of the options. Data2.dat the contents of (1:50, 11:15) Data
>> Type data2.dat% type directive can list the contents of data2.dat
>>% Load data1 read data1.mat stalls
>> X, y% in the recall data1.mat variables to read its contents (1:50, 11:15)
>>% Load data2.dat read data2.dat stalls
>> X2 = data2 (1:); y2 = data2 (2,:); will data2% in the first and second respectively disaggregated data x2 and y2
% Variables read, followed can be used in the computation of this two data
>> X = 21:25; y = 31:35;
>> Save data3.dat x y-ascii
>> Load data3.dat;
>> X3 = data3 (1:); y3 = data3 (2,:); will data3% in the first and second respectively x3 disaggregated data variables read and y3
%, Followed can be used in the computation of this two data
>> A = [1 2 3 4 5 6];
>> Save data4.dat A-ascii% will be deposited in A Numerical arrays data4 the ASCII-file
>> Load data4.dat
>> X4 = data4 (: 1); x4% for the first line of data data4
>> Y4 = data4 (:, 2);% for the y4 the second line of data data4
>> Data4 = z4 (:, 3); z4% for the third line of data data4