Can we specify or make uigetfile() remember its window position or view mode/sorting?
50 views (last 30 days)
Show older comments
I've always avoided using uigetfile() because of how cumbersome it is and because it doesn't adhere to any of my system preferences that affect file management dialogs in other applications. It never remembers what the last path was or how the window was configured.
I've managed to implement a workaround for making the path persistent, but I'm struggling to figure out any acceptable way of managing the window size, view mode, and sorting behavior without manually mousing every single time.
I could probably resort to doing some sort of bash script with xdotool and wmctrl that waits for the dialog to appear, but I want to know if there's something at least a little less ridiculous, but less involved than reimplementing the whole thing. I'm open to undocumented solutions, as I'm probably going to be the only one using it. Web searches haven't turned up anything, but I figured I'd ask.
2 Comments
Walter Roberson
on 17 Nov 2025 at 21:19
There might possibly have been some mechanism in R2019b (which you noted as your release), but by R2025a there is no hope.
Answers (2)
Matt J
on 17 Nov 2025 at 23:14
Edited: Matt J
on 18 Nov 2025 at 0:22
This file exchange submission seems to do most of the above,
The last position of the dialog is remembered automatically, and the FilterSpec option can beused ot specify the initial folder path.
6 Comments
Matt J
on 18 Nov 2025 at 3:59
Edited: Matt J
on 18 Nov 2025 at 4:03
That doesn't stop me from programmatically building a UI, but it's probably less convenient than intended.
Since you have R2019b, you still have GUIDE. I wonder if the text field issue affects that as well. If not, that would give you a better GUI-building alternative than purely programmatic GUI construction.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!