function flag = harray_set(h,varargin)

% harray_set - set properties for harray elements
% -----------------------------------------------
%
% flag = harray_set(h,'field',value, ... )
%
% Input:
% ------
%  h - harray structure array
%  field - axes property field name
%  value - axes property value
%
% Output:
% -------
%  flag - success flag

%--------------------------------
% Author: Harold Figueroa
%--------------------------------
% $Revision: 976 $
% $Date: 2005-04-25 19:27:22 -0400 (Mon, 25 Apr 2005) $
%--------------------------------

%--
% create persistent table of valid 'set' fields
%--

% TODO: find a better way of getting these field names

persistent AXES_SET_FIELDS;

if (isempty(AXES_SET_FIELDS))
			
	AXES_SET_FIELDS = lower(fieldnames(set(h(1).axes)));
	
end

%--
% get field value pairs
%--

[field,value] = get_field_value(varargin);

field = lower(field);

%--
% set axes properties
%--

flag = 1;

ax = cell2mat({h.axes}');

for k = 1:length(field)
	
	switch (field{k})
		
		%--
		% set component axes properties
		%--
		
		case (AXES_SET_FIELDS)
			
			try
				set(ax,field{k},value{k});
			catch
				flag = 0;
				disp(' ');
				disp(['WARNING: Unable to set property ''', field{k}, '''.']);
			end
		
		%--
		% unrecognized 'set' field
		%--
		
		otherwise
			
			flag = 0;
			disp(' ');
			disp(['WARNING: Unrecognized ''set'' field ''', field{k}, '''.']);
			
	end
	
end