 function [ShortCell] = GetColumnsGeneral(LongCell,ShortCell)
%[ShortCell] = GetColumnsGeneral(LongCell,ShortCell)
%This program compares the cell array string in shortcell to the 
%cell array of strings in longcell and finds the column in longcell
%in which the strings in shortcell are found in longcell
%every string in shortcell must also be in Longcell or the 
%program will return an error.
%
%INPUT
%LongCell = a cell array of strings that will be compared to ShortCell
%ShortCell = a cell array of string that will be compared to LongCell
%
%OUTPUT
%Shortcell = The first row of ShortCell contains the input cell array
%of strings while the second row contains the value of the second row in LongCell
%that contains the same string as ShortCell
%
%Written by K. Steffen (ksteffen@unm.edu) at the University of New Mexico,
%Department of Earch and Planetary Science
%Copyright 2003 Kurt Steffen
%
%Last Modified June 17, 2003
for k= 1:length(ShortCell)
    temp = ShortCell{1,k};  
    for m = 1:length(LongCell)    
        if strcmp(temp,LongCell{1,m})
            ShortCell{2,k} = m;
            break
        end
        if  m == length(LongCell)
			if iscell(temp)
				errorstring = ['Could not find column ' temp{:} ' in database'];
			else		
       	     	errorstring = ['Could not find column ' temp ' in database'];
			end	
            error(errorstring);
        end    
    end
end

