Code covered by the BSD License  

Highlights from
new_dir.m

4.0

4.0 | 2 ratings Rate this file 17 Downloads (last 30 days) File Size: 3.03 KB File ID: #25753

new_dir.m

by

 

05 Nov 2009 (Updated )

This is an enhancement to MATLAB's dir function, for dealing with sequentially numbered files.

| Watch this File

File Information
Description

This function is designed for dealing more easily with filenames. It is particularly useful for locating files with a numerical suffix, as might be used for data files that are sequentially numbered. In addition to the fields of dir, it also returns a path field and a number field. It also allows for executing functions whose input is a filename. Examples are open, delete, ...

Type help new_dir to find examples.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
24 Nov 2009 Jan Simon

Bugs are fixed, descriptive warning on Windows for the -find flag, updated description on the FEX page (removed "Matlab 5.3"), considering directories, some improvements in the help section. No comments in the source. Useful and usable.

18 Nov 2009 Jan Simon

The function starts with overwriting VARARGIN - please remove this!
The help section now mentions, that the -find option works on Unix only. But a check in the function (if ~isunix, error('-find works on Unix only'); end) would be useful.
Please update the file information on the FEX: This function does still not run under Matlab 5.3.
The help section is still hard to read (for me) due to the formatting. A H1-line would be helpful (see LOOKFOR command).
Some simplifications are possible, e.g.: "numel({d.name})" equals "numel(d)",
"to_do = strncmp( varargin, '-', 1 );
neg_queery = ~to_do&strncmp(varargin, '~', 1 );" is easier as: "neg_queery = strncmp(varargin, '~', 1);".
Comments in the source are recommended generally.
I really like the idea of expanding DIR with a filter for numerical indices.

08 Nov 2009 Jan Simon

In contrary to the file informations above, new_dir does not run on Matlab 5.3.1 (and 6.5 also), because the DIR command does not reply the field 'datenum' for this versions.
No meaningful H1 line, the help text is long and exhaustive, but hard to read (please insert a space after the %, limit the line width, use some empty lines to divide sections). A lot of examples are given, but some crash: There is no "-regexp" flag for the FIND command of Windows XP --- perhaps your function is written for Unix only?! If so, please mention this.
No comments in the source. The initial section for debugging is useless for FEX users.
If updates of this files are submitted or searched, it is helpful to mention the full name of the author and the exact date of submission.
Working partially on WindowsXP, but not under the claimed Matlab version.

Updates
16 Nov 2009

Bugs have been fixed, and examples are much easier. to get started create a test directory by typing "new_dir -generate", and follow the examples in help new_dir.

19 Nov 2009

Thanks for the comment Jan. I fixed the varargin bug (it was just an oversight), and adopted your other suggestions.

19 Nov 2009

Bug fix, and added the option to restrict search to directories or non-directories.

23 Nov 2009

Improvement for handling errors

Contact us