FINDFILEGROUPS-FindagroupoffilesbasedonparametersFILELIST=FINDFILEGROUPS(PARENTDIR,FILEPARAMETERS,...)Findsgroupsoffilesbasedonparameters.FILEPARAMETERSshouldbeacelllistoffilenamesearchparameters.Theseparameterscanincluderegularexpresionwildcards('.*')andsymbolsthatindicatethatthesamestringneedstobepresentacrossfiles('#').SearcheswillreturnmatchesofthesegroupsoffilesinPARENTDIRandallofitssubdirectories.FILELISTisacellarrayofalloftheinstancesofthesefilegroups.Thatis,FILELIST{i}istheithinstanceofthesefilegroups.ThefullpathfilenamesarereturnedintheentriesofFILELIST{i}.Thatis,FILELIST{i}{j}isthejthfileintheithinstanceofthefilegroups.Theparentdirectoryissearchedfirstformatches,andthenallsubdirectoriesaresearched.Thisfilecanbemodifiedbypassingname/valuepairs:Parameter(default):|Description:----------------------------------------------------------------------SameStringSearchSymbol('#')|Thesymboltobeusedtoindicatethethesame|stringacrossfilesUseSameStringSearchSymbol(1)|Shouldweusethesamestringsearchfield?UseLiteralCharacter(1)|UsetheLiteralCharacterSearchParentFirst(1)|Shouldwesearchtheparentbeforethesubdirectoriesofthe|parent?Otherwise,subdirectoriesaresearchedfirst.SearchParent(1)|Shouldwesearchtheparent?SearchDepth(Inf)|Howmanydirectories'deep'shouldwesearch?|0meansparentonly,1meansonefolderin,...Examples:ffg_prefix=[userpathfilesep'tools'filesep'vhlab-toolbox-matlab'...filesep'file'filesep'test_dirs'filesep];%locationoftestdirectories%findsallfileswith'.ext'extension.fileparameters={'.*\.ext\>'};filelist=findfilegroups([ffg_prefix'findfilegroupstest1'],fileparameters);%listallfilestoseewhichsubset(s)was(were)selected:dir(([ffg_prefix'findfilegroupstest1'filesep'**/*']))%findsallsetsoffiles'myfile.ext1'and'myfile.ext2'whenthesefiles%co-occurinthesamesubdirectoryofPARENTDIRfileparameters={'myfile.ext1','myfile.ext2'};%findsallsetsoffilesfilelist=findfilegroups([ffg_prefix'findfilegroupstest2'],fileparameters);dir(([ffg_prefix'findfilegroupstest2'filesep'**/*']))%findsallsetsoffiles'myfile_#.ext1'and'myfile_#.ext2',where# is %thesamestring,andwhenthesefilesco-occurinthesamesubdirectory.%Forexample,ifthefiles'stimtimes1.txt'and'reference1.txt'wereinthesame%subdirectory,thesewouldbereturnedtogether.fileparameters={'myfile_#.ext1','myfile_#.ext2'}filelist=findfilegroups([ffg_prefix'findfilegroupstest3'],fileparameters);dir(([ffg_prefix'findfilegroupstest3'filesep'**/*']))Seealso:STRCMP_SUBSTITUTE