Home How to tell MATLAB uigetfile (uigetdir) to default to Windows libraries?
Reply: 0

How to tell MATLAB uigetfile (uigetdir) to default to Windows libraries?

user1365
1#
user1365 Published in April 26, 2018, 5:38 am

Let's assume that I want to select all the mp3 files in a users Music library. I can access this library from Windows Explorer by typing libraries\Music into the path bar (address bar?). However in MATLAB if I try this with uigetfile or uigetdir it is not found and the default location is opened instead.

[fileName, pathName, ~] = uigetfile('*.mp3', 'Select Song','libraries\Music\');

According to this superuser question, the library is a Windows XML feature and not actually an environment variable. The suggestion there is to have users create environment variables. While my users could do that, I don't want to be IT support for the work group so I want a way to do this entirely from the app itself. I can't rely on hardcoded paths either, as some users have small hard drives and their libraries are pointed to network storage.

Microsoft provides this description using IShellLibrary. But I didn't find any information on using IShellLibrary within MATLAB. The default file window that opens has the libraries on the left-hand toolbar so it's not a big deal to have the user just select their documents or whatever. But it's not that clean.

Is there a way for MATLAB to recognize the user's Windows library location?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311464 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO