www.gusucode.com > mbcsimulink 工具箱 matlab 源码程序 > mbcsimulink/xregmaskinitialization.m
%XREGMASKINITIALIZATION helper script to initialise mask variables % % XREGMASKINITIALIZATION % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. % NOTE the cryptic use of aAbBzZ_ to attempt to avoid namespace clashes! % Get the userdata aAbBzZ_ud = get_param(gcb, 'userdata'); % Only initialise the variables if it is a structure if isstruct(aAbBzZ_ud) aAbBzZ_names = fieldnames(aAbBzZ_ud); aAbBzZ_values = struct2cell(aAbBzZ_ud); % Loop over the variables for aAbBzZ_i = 1:length(aAbBzZ_names) eval([aAbBzZ_names{aAbBzZ_i} '= aAbBzZ_values{aAbBzZ_i};']); end clear('aAbBzZ_names', 'aAbBzZ_values', 'aAbBzZ_ud', 'aAbBzZ_i'); elseif ischar( aAbBzZ_ud ) % get extension to determine how to load the file [~,aAbBzZ_nul,aAbBzZ_ext] = fileparts( aAbBzZ_ud ); switch lower( aAbBzZ_ext ) case '.mat' load( aAbBzZ_ud ); case '.m' eval( regexprep( aAbBzZ_ud, '\.m$', '' ) ); otherwise error(message('mbc:xregmaskinitialization:InvalidParameterValue')); end clear( 'aAbBzZ_nul', 'aAbBzZ_ext', 'aAbBzZ_ud' ); end