Using uigetfile to select file in App Designer is causing the matlab script to open after file is selected
조회 수: 49 (최근 30일)
이전 댓글 표시
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
Geoff Hayes
2021년 9월 29일
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).
채택된 답변
Kevin Holly
2021년 9월 29일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!