www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@buttonbar/enablebutton.m

    function enablebutton(obj,index,state)
%ENABLEBUTTON Enables or disables buttons at specified indices
%
%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


s = obj.ButtonEnable;
if ischar(s)
    s = repmat({s},size(obj.buttons));
end

if length(index)==1 && ischar(state)
    s{index} = state;
else
    if ischar(state)
        state = repmat({state},size(index));
    end
    s(index) = state;
end

obj.ButtonEnable = s;