function nof=noFiles(pattern); %% =========================================================================== %noFiles - Count the number of files in the current directory that % contains the pattern. % % Parameter: pattern Pattern to look for % Returns: nof Number of files % % Example(s): % nodiaryfiles=noFiles('diary*'); % totnofiles=noFiles; % %% =========================================================================== %% =========================================================================== % Copyright (C): % 2003 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % % CVS: $Id: noFiles.m,v 3.1 2003/11/03 15:48:35 tono Exp $ %% =========================================================================== % Change History % 2003-11-03 (ToNo) Created %% =========================================================================== if nargin<1, pattern='*'; end if onMatlab nof=length(dir(pattern)); else % Octave % This might not work under Windows nof=str2num(system(['ls ' pattern ' | wc -l'])); end;