function out = cvstSetCoordsChoice(varargin)
%cvstSetCoordsChoice Sets preference of coordinate system.
%   cvstSetCoordsChoice(S) sets choice of a coordinate system for the 
%   client based on scalar S. Set S to 1 for X, Y coordinates with origin 
%   at (1,1) and 0 for R, C coordinates with origin at (0,0).
%
%   See also cvstGetCoordsChoice

%   Copyright 2011 The MathWorks, Inc.
%   $Revision: 1.1.6.4 $  $Date: 2011/05/09 03:47:08 $

persistent cvstCS;
mlock; % prevent the persistent variable from being cleared easily

if isempty(cvstCS)
    cvstCS = 1; % set default coordinate system (1 for new, 0 for old)
end

narginchk(0,1);
nargoutchk(0,1);

if nargin == 1;
    s = varargin{1};
    validateattributes(s,{'double','logical'},...
        {'scalar','binary'},mfilename,'S',1);
        
    cvstCS = double(s); % all s-functions expect double input
end

if nargout == 1
    out = cvstCS;
end
