function setvars(vnames,vdat,rowdat)
% creates all the compound data variables
global nc
nvars=size(vnames);
nrd=size(rowdat);
% making the variables global in this function
eval(['global' reshape(vnames',1,nvars(1)*nvars(2))])
nl=1;
for k=1:nvars(1)
   mxrw=vdat(1,k);
   nrow=vdat(3,k);
   ncol=vdat(2,k);
   vnm=vnames(k,:);
   if vdat(4,k)
% setting a numeric array
      mat=ones(mxrw,ncol)*NaN;
      eval([vnm '=mat;'])
      for j=1:nrow
         eval([vnm '(' rowdat(nl,1:5) ',:)=[' rowdat(nl,6:nrd(2)) '];'])
         nl=nl+1;
      end
   else
% setting a character array
      mat=blank(mxrw,nrd(2)-5);
      eval([vnm '=mat;'])
	  lenx=0;
      for j=1:nrow
         rown=rowdat(nl,6:nrd(2));
		 len=findstr(rown,'  ');
		 if ~isempty(len)
		    lenx=max(lenx,len(1)-1);
		 else
		    lenx=nrd(2)-5;
		 end
         eval([vnm '(' rowdat(nl,1:5) ',:)=rown;'])
         nl=nl+1;
      end
% making the character array the length of the longest name
	  eval([vnm,'=',vnm,'(:,1:lenx);'])
   end
end
