"uigetfile" only opens the matlab drive, not local file explorer

3 views (last 30 days)
I'm trying to create an app where the user needs to upload a picture of themselves, but whenever I use "uigetfile" it only opens up my matlab drive, not my computer's local file explorer so I can't access local images. Any help would be appreciated. My code is below. Thank you!
% Button pushed function: Uploada1x1pictureofyourselfButton
function Uploada1x1pictureofyourselfButtonPushed(app, event)
global Image;
[file,path] = uigetfile(".jpg");
Image = imread(fullfile(path,file));
imshow(Image, 'parent', app.UIAxes);

Answers (1)

Bruno Luong
Bruno Luong on 16 Nov 2022
uigetfile open a file browser controller by the operating system. Usually user can navigate whereever he is allowed and in the drive he/she can see by the account controlled by the operating system. This is not controlled by MATLAB.
On windows, if you know the drive letter (D as example here) you can start by default in thid drive like this
[file,path] = uigetfile("D:\*.jpg");

Categories

Find more on Develop Apps Using App Designer 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!