www.gusucode.com > vnt工具箱matlab源码程序 > vnt/vntblks/vntmasks/private/privatecanslbitparameters.m

    function privatecanslbitparameters(dialog, value, tag)
%PRIVATECANSLBITPARAMETERS Callback to validate the bit parameters.
%
%    PRIVATECANSLBITPARAMETERS(DIALOG, VALUE, TAG) is used as a callback to 
%    validate the bit parameters contained in DIALOG, a dialog object and
%    VALUE is the current changed value of the field, TAG.

%    SS 04-01-08
%    Copyright 2008 The MathWorks, Inc.

% Get the dialog source object.
obj = dialog.getDialogSource;

% Get configuration block widget tags.
tags = privatevntslstring('cancb');

% Get error strings.
errorStrings = privatevntslstring('errorstrings');

valueDouble = str2double(value);

% Check for non-scalar, non-numeric and negative values.
if (isnan(valueDouble) || isempty(valueDouble) || ~isscalar(valueDouble) || valueDouble<0 || ...
    ~isnumeric(valueDouble) || isinf(valueDouble) || valueDouble ~= floor(valueDouble))
    
    widgetLabel = dialog.getWidgetPrompt(tags.(tag));
    errMsg = sprintf(errorStrings.BitParameterInvalid, widgetLabel(1:end-1));
    tamslgate('privatesldialogbox', dialog, errMsg, ...
                                errorStrings.ErrorDialogTitle, tag);
    % Set focus back to appropriate field.
    dialog.setFocus(tag);
    return;
end
obj.(tag) = obj.Block.(tag);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%