FINDCELLS performs a search on MATLAB cell arrays of structures INDEX = FINDCELLS(CELLARRAY, 'field') returns indexes of elements that have a field named 'field' INDEX = FINDCELLS(CELLARRAY, 'field', VALUE) returns indexes of elements whose field 'field' is equal to VALUE1, VALUE2, ... or VALUEN. Where VALUE can either be character strings or a number. If its a character string REGULAR expressions can be used. Example: findcells(THERING,'Length',0, 0.2); % will match elements of lengths 0 and 0.2 findcells(THERING,'FamName','SFA','SDA'); See also ATGETCELLS, GETCELLSTRUCT, SETCELLSTRUCT, REGEXPI
0001 function index = findcells(CELLARRAY, field, varargin) 0002 %FINDCELLS performs a search on MATLAB cell arrays of structures 0003 % 0004 % INDEX = FINDCELLS(CELLARRAY, 'field') 0005 % returns indexes of elements that have a field named 'field' 0006 % 0007 % INDEX = FINDCELLS(CELLARRAY, 'field', VALUE) 0008 % returns indexes of elements whose field 'field' 0009 % is equal to VALUE1, VALUE2, ... or VALUEN. Where VALUE can either be 0010 % character strings or a number. If its a character string REGULAR 0011 % expressions can be used. 0012 % 0013 % Example: 0014 % findcells(THERING,'Length',0, 0.2); % will match elements of 0015 % lengths 0 and 0.2 0016 % findcells(THERING,'FamName','SFA','SDA'); 0017 % 0018 % See also ATGETCELLS, GETCELLSTRUCT, SETCELLSTRUCT, REGEXPI 0019 0020 index=reshape(find(atgetcells(CELLARRAY,field,varargin{:})),1,[]);