⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iptsetpref.m

📁 有关matlab的电子书籍有一定的帮助希望有用
💻 M
字号:
function varargout = iptsetpref(prefName, value)
%IPTSETPREF Set Image Processing Toolbox preference.
%   IPTSETPREF(PREFNAME,VALUE) sets the Image Processing Toolbox
%   preference specified by the string PREFNAME to VALUE. The
%   setting persists until the end of the current MATLAB session,
%   or until you change the setting. (To make the value persist
%   between sessions, put the command in your startup.m file.)
%
%   Preference names are case insensitive and can be
%   abbreviated.
%
%   The following preference values can be set:
%
%   'ImshowBorder'        'loose' (default) or 'tight'
%
%        If 'ImshowBorder' is 'loose', IMSHOW displays images
%        with a border between the image and the edges of the
%        figure window, thus leaving room for axes labels,
%        titles, etc. If 'ImshowBorder' is 'tight', then IMSHOW
%        adjusts the figure size so that the image entirely fills
%        the figure. (However, there may still be a border if the
%        image is very small, or if there are other objects
%        besides the image and its axes in the figure.)
%
%   'ImshowAxesVisible'   'on' or 'off' (default)
%
%        If 'ImshowAxesVisible' is 'on', IMSHOW displays images
%        with the axes box and tick labels.  If
%        'ImShowAxesVisible' is 'off', IMSHOW displays images
%        without the axes box and tick labels.
%
%   'ImshowTruesize'      'auto' (default) or 'manual'
%
%        If 'ImshowTruesize' is 'manual', IMSHOW does not call
%        TRUESIZE. If 'ImshowTruesize' is 'auto', IMSHOW
%        automatically decides whether to call TRUESIZE. (IMSHOW
%        calls TRUESIZE if there will be no other objects in the
%        resulting figure besides the image and it axes.) You can
%        override this setting for an individual display by
%        specifying the DISPLAY_OPTION argument to IMSHOW, or you
%        can call TRUESIZE manually after displaying the image.
%
%   'TruesizeWarning'     'on' (default) or 'off'
%
%        If 'TruesizeWarning' is 'on', TRUESIZE displays a
%        warning if the image is too large to fit on the
%        screen. If 'TruesizeWarning' is 'off', TRUESIZE does not
%        display the warning. Note that this preference applies
%        even when you call TRUESIZE indirectly, such as through
%        IMSHOW.
%
%   IPTSETPREF(PREFNAME) displays the valid values for PREFNAME.
%
%   Example
%   -------
%       iptsetpref('ImshowBorder', 'tight')
%
%   See also IMSHOW, IPTGETPREF, TRUESIZE.

%   Steven L. Eddins, January 1997.
%   Copyright 1993-1998 The MathWorks, Inc.  All Rights Reserved.
%   $Revision: 1.9 $  $Date: 1997/11/24 15:35:43 $

error(nargchk(1,2,nargin));

if (~ischar(prefName))
    error('First input argument must be a property name string');
end

% Get factory IPT preference settings.
factoryPrefs = iptprefs;  
allNames = factoryPrefs(:,1);

% Convert factory preference names to lower case.
lowerNames = cell(size(allNames));
for k = 1:length(lowerNames)
    lowerNames{k} = lower(allNames{k});
end

matchIdx = strmatch(lower(prefName), lowerNames);
if (isempty(matchIdx))
    error(sprintf('Unknown Image Processing Toolbox preference "%s".', prefName));
elseif (length(matchIdx) > 1)
    error(sprintf('Ambiguous Image Processing Toolbox preference "%s".', prefName));
else
    preference = allNames{matchIdx};
end

allowedValues = factoryPrefs{matchIdx, 2};

if (nargin == 1)
    if (nargout == 0)
        % Print possible settings
        defaultValue = factoryPrefs{matchIdx, 3};
        if (isempty(allowedValues))
            fprintf('The Image Processing Toolbox preference setting\n');
            fprintf('"%s" does not have a fixed set of values.\n', preference);
        else
            fprintf('[');
            for k = 1:length(allowedValues)
                thisValue = allowedValues{k};
                isDefault = ~isempty(defaultValue) & ...
                        isequal(defaultValue{1}, thisValue);
                if (isDefault)
                    fprintf(' {%s} ', num2str(thisValue));
                else
                    fprintf(' %s ', num2str(thisValue));
                end
                notLast = k ~= length(allowedValues);
                if (notLast)
                    fprintf('|');
                end
            end
            fprintf(']\n');
        end
        
    else
        % Return possible values as cell array.
        varargout{1} = factoryPrefs{matchIdx,2};
    end
    
else
    % Syntax: IPTSETPREF(PREFNAME,VALUE)
    
    valueIsAcceptable = 0;
    for k = 1:length(allowedValues)
        if (isequal(value, allowedValues{k}))
            valueIsAcceptable = 1;
            iptregistry(setfield(iptregistry, preference, value));
            break;
        end
    end
    
    if (~valueIsAcceptable)
        error(sprintf(['Unacceptable value for Image Processing' ...
                    ' Toolbox preference "%s".'], preference));
    end
        
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -