File Exchange

image thumbnail

Default_Path_Retrie​val

version 1.1.0.0 (4.51 KB) by Thomas Clark
Save and retrieve last-used path strings. Ideal for users of uigetfile() and similar functions.

0 Downloads

Updated 16 Sep 2009

View License

_________
This function can help if you:
- frequently access/write files/folders which are not necessarily on your MATLAB path

- Do lots of load/save type operations to various different destinations

- Use dialogue functions like uigetfile() and uigetdir()
_________

What it does:
If you have a path string in your current workspace, you can add it to a single database file.

At a later date, use a simple command to retrieve the path for reuse.

The database file is automatically created; there is no need to edit it manually.
_________

How I use it:
I write toolboxes. So in the toolbox I'm currently writing, users load image files, they load calibration files, and they load results files.

Each time uigetfile() is used to locate a file (of a given type), I use these functions to get the directory path of the last-accessed file of the required type. I pass this to the DefaultName input for uigetfile.

Result: The uigetfile() dialogue box goes to the most likely folder in which that file type is stored, instead of starting in the MATLAB current directory.

Comments and Ratings (1)

This function is to retrieve file the previous path
i need to save file1 in user defined folder for eg. folder1
once saved while saving file2 it should not ask for the path, it should directly go and save in folder1 or the path should be taken directly to folder1
similarly as goes on

Updates

1.1.0.0

Update 16 Sept 2009:
- Fixed a permissions related bug (writing to matlabroot) in linux/unix
- Database file is now saved with m-files instead of in matlabroot
- Couple of code-tidiers (e.g. use of dynamic fieldnames)

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: M-file Header Template

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor