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

    %% Create a Preference Using Specified Default Value
%%

% Copyright 2015 The MathWorks, Inc.

setpref('mytoolbox','version','1.0')
rmpref('mytoolbox','version')
getpref('mytoolbox','version','1.0');
getpref('mytoolbox','version')
%%
% The first call to |getpref| adds the |'version'| preference and sets its value to the default value, |1.0|. 
% The second call to |getpref| verifies that the preference exists, and that its value is |1.0|.