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

    function doValue( obj )
%DOVALUE Execute change of value property
%  
%  DOVALUE(OBJ)
%

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


if ishandle(obj.imageSource)
    % work out the correct frame number to use.
    nFrames = obj.ImageSource.numImages;  
    if ~isfinite(obj.Min) || ~isfinite(obj.Max) || (obj.Min>=obj.Max)
        % Special case for badly defined min/max
        obj.CurrentFrame = 1;
    else
        val = min(max(obj.Value, obj.Min), obj.Max);
        obj.CurrentFrame = round(1 + (val-obj.Min).*(nFrames-1)./(obj.Max-obj.Min));
    end
else
    obj.CurrentFrame = 0;
end