Code covered by the BSD License  

Highlights from
Default_Path_Retrieval

Be the first to rate this file! 4 Downloads (last 30 days) File Size: 4.51 KB File ID: #24965

Default_Path_Retrieval

by Thomas Clark

 

08 Aug 2009 (Updated 16 Sep 2009)

Save and retrieve last-used path strings. Ideal for users of uigetfile() and similar functions.

| Watch this File

File Information
Description

_________
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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
M-file Header Template

MATLAB release MATLAB 7.6 (R2008a)
Other requirements None to my knowledge, but I haven't tested on MACs. If someone uses it successfully on MACs, could you let me know please?
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
16 Sep 2009

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)

Tag Activity for this File
Tag Applied By Date/Time
uigetfile Thomas Clark 10 Aug 2009 11:48:22
uigetdir Thomas Clark 10 Aug 2009 11:48:22
uiputfile Thomas Clark 10 Aug 2009 11:48:22
path handling Thomas Clark 10 Aug 2009 11:48:22
path Thomas Clark 10 Aug 2009 11:48:22
default path Thomas Clark 10 Aug 2009 11:48:22
defaultname Thomas Clark 10 Aug 2009 11:48:22

Contact us at files@mathworks.com