Using uigetfile to select file in App Designer is causing the matlab script to open after file is selected

47 visualizzazioni (ultimi 30 giorni)
Hey everyone,
I am having some issues here and I'd greatly appreciate some help.
I am using uigetfile to let user select a type- file in App Designer, but once the file is selected, it goes back to matlab script, and not to the App GUI in app designer.
I have two different app functions for this. I have a BrowseFileNameButton (button), and I have FileName (which is a blank text field, to take the value of the Filename selected.
The below code works, and fills in the correct value that I want for FileName, but how do I get it to go back to the GUI screen after the browse folder box appears? Why does it keep going back to matlab script?
Thanks so much!
% Button pushed function: BrowseFileNameButton
function BrowseFileNameButtonPushed(app, event)
[fileName,filePath] = uigetfile('Test/Data/*.mat');
app.FileName.Value = [fileName,filePath];
end
  1 Commento
Geoff Hayes
Geoff Hayes il 29 Set 2021
Akana - I'm not too sure what you mean by it goes back to matlab script. What script? The above is BrowseFileNameButtonPushed seems to be just a callback for your button so you should still be "in" your GUI once the callback completes...and so the GUI should still respond to interactions with you (the user).

Accedi per commentare.

Risposta accettata

Kevin Holly
Kevin Holly il 29 Set 2021
You can try this:
% Button pushed function: BrowseFileNameButton
function BrowseFileNameButtonPushed(app, event)
[fileName,filePath] = uigetfile('Test/Data/*.mat');
app.FileName.Value = [fileName,filePath];
drawnow;
figure(app.UIFigure)
end

Più risposte (0)

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by