function f=rhofunc(z)
%RHOFUNC(Z)
%	F= RHOFUNC(Z) vertically interpolates data in tabular form 
%	from vectors DATA and DEPTHS
%
%	The input Z is the depth.
%	
%	Vectors DATA and DEPTHS must have been defined GLOBAL
%
%	John Wilkin
%	25 October 92

if exist('DATA') ~= 1
  error('I dont think you defined DATA to be global')
end
if exist('DEPTHS') ~= 1
  error('I dont think you defined DEPTHS to be global')
end

[m,n] = size(DATA);
if m==1
  if n==1
    error('DATA must be a vector')
  end
  DATA = DATA';
end
[m,n] = size(DATA);

[mm,nn] = size(DEPTHS);
if mm==1
  if nn==1
    error('DEPTHS must be a vector')
  end
  DEPTHS = DEPTHS';
end
[mm,nn] = size(DEPTHS);

if m ~= mm
  error('DATA and DEPTHS are different lengths')
end

TAB = [DEPTHS DATA];

f = table1(TAB,z);



