OUTSTRUCT = KEEPFIELD(INSTRUCT,FIELDNAMES) Removes all fields from a structure other than those specified in input variable FIELDS. FIELDS may be a single field, or a cell array of field names ex: a = dir('*.m'); b = keepfield(a,{'name','bytes'}); See also: rmfield