www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SaveSpecificVariablestoMATFileExample.m

    %% Save Specific Variables to MAT-File  
% Create and save two variables, |p| and |q|, to a file called |pqfile.mat|.   

% Copyright 2015 The MathWorks, Inc.


%%  
p = rand(1,10);
q = ones(10);
save('pqfile.mat','p','q') 

%%
% MATLAB(R) saves the variables to the file, |pqfile.mat|, in the current
% folder.  

%% 
% You also can use command syntax to save the variables, |p| and |q|. 
save pqfile.mat p q