function fieldsCell = grabfields(structIn,fieldName);
% grabfields(scructIn,'fieldName') will grab the named field off of
% the struct, structIn, sort it alphabetically, and return it as a

% cell. 
%
% 2/03 by ras
for i = 1:length(structIn)
	entry = getfield(structIn(i),fieldName);
	fieldsCell{i} = getfield(structIn(i),fieldName);
end

if ischar(fieldsCell{1})
	fieldsCell = sort(fieldsCell);
elseif isnumeric(fieldsCell{1})
	for i = 1:length(fieldsCell)
		if isnumeric(fieldsCell{i})
			tmp(i) = fieldsCell{i};
		else
			tmp(i) = 0;
		end
	end
	fieldsCell = tmp;
end

return
