# SelectFiles

## PURPOSE

Prompt user for directory containing files

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Prompt user for directory containing files

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 % Prompt user for directory containing files
    0002 zPathName = uigetdir;
    0003 Files = dir(zPathName);
    0004 allFiles = {Files.name};
    0005 filefind=strfind(allFiles,'.mat')';
    0006 filesidx=nan(size(filefind,1),1);
    0007 for i=1:size(filefind,1)
    0008     filesidx(i,1)=size(filefind{i},1);
    0009 end
    0010 filesidx=find(filesidx>0);
    0011 files=allFiles(filesidx);
    0012
    0013 % Allow user to select which files are to be processed
    0014 selection = listdlg('ListSize',[300 300],'ListString', files);
    0015 zFileName = files(selection);
    0016
    0017 % Determine number of files to be processed
    0018 if  isa(zFileName,'cell')
    0019     zf=size(zFileName,2);
    0020     zFileName=sort(zFileName);
    0021 else
    0022     zf=1;
    0023     zFileName={zFileName}
    0024 end
    0025
    0026 clear Files allFiles filefind files filesidx i selection zPathName