image thumbnail

Generates free pathname for a file

version (2.05 KB) by Alexandre
Generates pathname to a non-existing file so you can save data without overwriting an existing file.


Updated 05 Nov 2012

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.

Cite As

Alexandre (2021). Generates free pathname for a file (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!