function bool = isfield(s, name)
%SAXS/ISFIELD True if field name is a (readable) SAXS object field.
%   ISFIELD(S, 'name') returns true (1) if name is a readable field in SAXS
%   image object S.

if ischar(name)  % ferret out bad data types
    switch name
        case {'pixels', 'type', 'relerr','error_norm_fact','datatype','detectortype',...
                    'cmask_radius', 'cmask_outer','xaxis', 'xaxisfull','yaxis',...
                    'xaxisbintype','log', ...
                    'realtime', 'livetime', 'transfact', 'sample_thickness',...
                    'calibrationtype','kcal', 'pixelcal', 'koffset', ...
                    'wavelength','pixelsize','detector_dist',...
                    'reduction_type','reduction_state','raw_filename','raw_date','raw_pixels','raw_center',...
                    'bsmask_configuration','bsmask_pixels',...
                    'mask_filename','mask_pixels', ...
                    'flatfield_filename','flatfield_pixels','flatfieldtype', ...
                    'empty_filename','empty_pixels','empty_transfact','empty_livetime',...
                    'solvent_filename','solvent_pixels','solvent_transfact','solvent_livetime','solvent_thickness',...
                    'darkcurrent_filename','darkcurrent_pixels','darkcurrent_livetime',...
                    'readoutnoise_filename','readoutnoise',...
                    'zinger_removal',...
                    'abs_int_fact',...
                    'sample_description',...
                    'sample_condition.xpos','sample_condition.ypos',...
                    'sample_condition.angle1','sample_condition.angle2','sample_condition.angle3',...
                    'sample_condition.temp','sample_condition.pressure','sample_condition.strain','sample_condition.stress',...
                    'sample_condition.shear_rate',...
                    'sample_condition.sample_conc',...
                    'exp_conf.d1','exp_conf.d2','exp_conf.d3',...
                    'exp_conf.l1','exp_conf.l2','exp_conf.l3','exp_conf.l4',...
                    'exp_conf.wavelength','exp_conf.deltawavelength','exp_conf.Izero',...
                    'exp_conf.det_pixsizex','exp_conf.det_pixsizey',...
                    'exp_conf.det_offx','exp_conf.det_offy',...
                    'exp_conf.det_rotx','exp_conf.det_roty',...
                    'exp_conf.det_resx','exp_conf.det_resy','exp_conf.det_rel_eff'...
                    'added_constant','multiplication_factor',...
                    'userdata_cell','metadata',...
                    'history'}
            bool = 1;
        otherwise
            bool = 0;
    end
else  % wrong data type
    error('Field name argument must be a character string.')
end
            