File Exchange

image thumbnail

Generates free pathname for a file

version 1.1 (2.05 KB) by

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

0 Downloads

Updated

View License

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.

Comments and Ratings (2)

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.

Richard Crozier

You could just use the built-in tempname function

Updates

1.1

Faster for large number of existing files.

MATLAB Release
MATLAB 7.12 (R2011a)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video