Clicking app button moves app behind Matlab's main window.

3 次查看(过去 30 天)
I made an app button that loads a datafile with uigetfile. It works, but after clicking on the file, my app window moves behind the main Matlab window. There must be a way to keep my app in front of Matlab after executing a callback. Callback code is based on the example:
% Display uigetfile dialog
filterspec = {'*.nev;*.dat;','All Data Files'};
[f, p] = uigetfile(filterspec);
% Make sure user didn't cancel uigetfile dialog
if (ischar(p))
fname = [f];
app.EditField.Value = fname;
end
  1 个评论
Jan
Jan 2022-10-30
Just a note: I get the file name and the path in uigetfile. Then use the path:
[f, p] = uigetfile(filterspec);
if ischar(p)
app.EditField.Value = fullfile(p, f);
end
This sets a field to the specified value, but does not load a file.

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2022-10-30
编辑:Jan 2022-10-30

类别

Help CenterFile Exchange 中查找有关 App Building 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by