Code covered by the BSD License  

Highlights from
Generates free pathname for a file

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 2.05 KB File ID: #38442

Generates free pathname for a file

by

 

01 Oct 2012 (Updated )

Generates pathname to a non-existing file so you can save data without overwriting an existing file.

| Watch this File

File Information
Description

Usage : filename = genfilename(fname)
This simple code will generate a 'free' pathname based on your suggestion (fname), to make sure you can save your data to a file without overwriting to an existing one.

Simple options allow you to use a certain number of digits or start numbering at a defined number.

MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
04 Oct 2012 Alexandre

(i did not know that function so thanks)
You are right, but one advantage of my script is that you still get control on the name of the file. It's basically for saving multiple versions of the same file, you will have a different number each time to avoid overwriting on the previous one.

04 Oct 2012 Richard Crozier

You could just use the built-in tempname function

Updates
05 Nov 2012

Faster for large number of existing files.

Contact us