I made a Matlab GUI. I would like to set the dialog box for input file to be by default set to 'Computer' directory. I know how to change the default path ([FileName PathName] = uigetfile('D:\Applications\Matlab6p5\work\*.m;*.mdl;*.mat','MATLAB Files');
), but I don't know what is the name of the path in case of 'Computer' (directory where all server and local disc names are listed). Any suggestions?
In the Current Folder browser, right-click any MATLAB Drive file or folder and select MATLAB Drive > Go to MATLAB Drive Online.... To open the Current Folder browser if it is not visible, go to the Home tab, and in the Environment section, click Layout. Then, under Show, select Current Folder.
file = uigetfile opens a modal dialog box that lists files in the current folder. It enables a user to select or enter the name of a file. If the file exists and is valid, uigetfile returns the file name when the user clicks Open. If the user clicks Cancel or the window close button (X), uigetfile returns 0 .
Run the path command to view all the folders on the MATLAB search path. Alternatively, use the Set Path dialog box to view the entire MATLAB search path. On the Home tab, in the Environment section, click Set Path. The Set Path dialog box opens, listing all folders on the search path.
Create a directory My Computer.{20d04fe0-3aea-1069-a2d8-08002b30309d}
that links to the node "My computer" (see this answer on SU)- you can do the same with other "special folders" - see e.g. the comment by @thewaywewalk.
Use this directory as the start path for uigetfile
.
Thus:
tmpLinkToMyComputer = fullfile(tempDir,'MyComputer.{20d04fe0-3aea-1069-a2d8-08002b30309d}');
mkdir(tmpLinkToMyComputer);
uigetfile(fullfile(tmpLinkToMyComputer,'*.m;*.mdl;*.mat'),'MATLAB Files')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With