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

3 Ansichten (letzte 30 Tage)
Bianca Althea
Bianca Althea am 16 Nov. 2022
Beantwortet: Bruno Luong am 16 Nov. 2022
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);

Antworten (1)

Bruno Luong
Bruno Luong am 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");

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by