function settype(v,t)
% SETTYPE   Set variable type for a STAPLOT (qv) variable.
%
%   USAGE   SETTYPE(VARIABLE_NAME(S),VARIABLE_TYPE(S))
%
%           Valid VARIABLE NAMES are those on the plot list. Input may
%           be a single variable name and type, or a matrix of names and
%           a vector of types. (To construct a matrix of variable names,
%           see STR2MAT.)
%
%           Valid VARIABLE TYPES are the integers 1,2, and 3.
%
%           Type 1: a vector with one value per station.
%          
%           Type 3: a matrix with a column of values per station.
%           
%           Type 2: a vector with the length "depth", where depth is the 
%           maximum number of values you have for any station (i.e. the 
%           row number of your type 3 variables).  A word of warning is 
%           appropriate here:  If you have type 3 data matrices of 
%           different sizes, (perhaps properties of different vertical
%           resolutions in your data?), using type 2 variables can be 
%           problematic.  You will need to define separate type 2 variables
%           for each type 3 of a different length, and plot the offending
%           variables each versus its own type 2 or type 3 partner.

%           Deirdre Byrne, L-DEO, 96/05/26

global proplist typevar
if nargin ~= 2
  disp('Usage settype(variable_name,variable_type)')
  return
else
  if ~isstr(v)
    disp('Usage settype(variable_name,variable_type)')
    return
  else
    tt = max(size(t)); % check variable types
    for j = 1:tt
      if (t(j) < 1) | (t(j) > 3) | (round(t(j)) ~= t(j))
	disp(['A variable_type of ' num2str(t(j)) ' is not valid.'])
	return
      end
    end
    
    % ok, go ahead
    r = size(v); s = size(proplist); 
    if r(1) ~= tt
      disp('Input arguments are not the same size.')
      return
    else
      for j = 1:tt
	f = 0;
	for i = 1:s(1)
	  if strcmp(deblank(proplist(i,:)),deblank(v(j,:)))
	    f = 1;
	    typevar(i) = t(j);
	    break
	  end
	end
	if ~f
	  disp(['Warning: variable ''' deblank(v(j,:)) ''' was not found'])
	end
      end
      return
    end
  end
end
