Filter löschen
Filter löschen

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

53 Ansichten (letzte 30 Tage)
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 Kommentar
Geoff Hayes
Geoff Hayes am 29 Sep. 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).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kevin Holly
Kevin Holly am 29 Sep. 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

Weitere Antworten (0)

Kategorien

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

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by