File Exchange Pick of the Week

January 1st, 2010

uiputfile2

Happy New Year!

  • Wow - 2010. It's a whole new decade.

Bob's pick this week is uiputfile2 by Chris Cannell.

This utility function is a wrapper to MATLAB's uiputfile command. What does it add? Memory. More specifically, it remembers the folder where the last file was saved. So when users of your GUIs want to save files, they don't have to navigate to their favorite folders every time. Nice.

Chris chose to implement uiputfile2 by simply saving the information (path to folder) in a MAT file. That way it remembers from MATLAB session to session. That strategy is also robust to upgrades. Sweet.

I know I could program the logic myself, but thanks to Chris I don't have to!

Comments?

See also (2010-01-05 update)

As Aurélien noted in addition to uiputfile2 Chris also posted uigetdir2 as well as uigetfile2. They also are similar location-persistent wrappers to uigetdir and uigetfile respectively.


Get the MATLAB code

Published with MATLAB® 7.10

7 Responses to “uiputfile2”

  1. Mark replied on :

    Link is broken, should be http://www.mathworks.com/matlabcentral/fileexchange/9312

    …also it’s only a new decade for C++ programmers. MATLAB and Fortran users have to wait another year.

  2. jiro replied on :

    Thanks, Mark. The link is fixed.

  3. Aurélien Queffurust replied on :

    I also use from the same author uigetdir2 . It is the same logic : a mat-file which remembers the last folder previously selected with uigetdir.
    Easy and efficient !

    Happy new year Robert and mathworkers!

    Aurélien

  4. Chris Cannell replied on :

    I’m glad this code was useful to others. Enjoy.

  5. Bob replied on :

    Aurélien made a great point. I updated this post to now include the full set of UIPUTFILE2, UIGETFILE2 and UIGETDIR2 submissions from Chris. Much appreciated!

  6. Thomas Clark replied on :

    Hey all,

    Sorry to plug my own code, but there’s a similar approach in my submission ‘Default Path Retrieval’.

    It is a little more complicated than uiputfile2, but I think it’s more versatile as you can use it for path retrieval, rather than just wrapping a specific file-handling GUI.

    http://www.mathworks.com/matlabcentral/fileexchange/24965-defaultpathretrieval

    Cheers anyway, I like that uiputfile2 is nice and simple :)

    Tom C

  7. Clayton Chu replied on :

    Can we somehow make this behavior the default for MATLAB?


MathWorks

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

These postings are the author's and don't necessarily represent the opinions of MathWorks.