www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/WriteDataIntoAMATFileExample.m
%% Write Data Into a MAT File %% % *Note*: This example runs only in R2016b or later. If you are using an % earlier release, replace each call to the function with the equivalent % |step| syntax. For example, myObject(x) becomes step(myObject,x). %% % First, create a variable name. filename = [tempname '.mat']; %% % Next, write that variable to a MAT-file. hmfw = dsp.MatFileWriter(filename, 'VariableName', 'originalData'); for i=1:10 originalData = rand(4,2); step(hmfw, originalData); end release(hmfw); % This will close the MAT file %% % Finally, load the variable back into MATLAB. data = load(filename, 'originalData');