set a pic in GUI

2 ビュー (過去 30 日間)
R Hebi
R Hebi 2019 年 11 月 18 日
コメント済み: Adam Danz 2019 年 11 月 19 日
Hi,
I need help on the following matter:
I am desgning a GUI and I would like to set a PIC that when the user open the GUI it will appear only for few seconds, then the GUI intrface will start.
It is just like a welcoming pic.
I used the following command to convert the pic to fig
img = imread('~~.jpg');
imshow(img);
savefig('~~~.fig');
  2 件のコメント
Adam Danz
Adam Danz 2019 年 11 月 18 日
Where should the image appear? In an axes that is embedded within the GUI? In the GUI Figure background? On a separate window?
How did you create you GUI? Guide? App designer? uicontrol?
R Hebi
R Hebi 2019 年 11 月 19 日
I used Guide
I want it to appear on a separate window.

サインインしてコメントする。

採用された回答

Ankit
Ankit 2019 年 11 月 19 日
編集済み: Ankit 2019 年 11 月 19 日
Updated based on Adam's comment! Thanks for your feedback.
-------------------------------------------------------------------------------
Hi Abdullah,
You can modify the below code based on your need. Include the following code in your opening function of GUI.
function xxxx_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for xxxx
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
%creating a new figure
Figure = ...
figure('Name', 'Splashscreen',...
'Color', 'w',...
'NumberTitle', 'off',...
'Toolbar', 'none',...
'Menubar', 'none',...
'Resize', 'off',...
'Visible', 'off',...
'Units', 'Pixels',...
'Position', [624 694 494 409]);
movegui(Figure,'center'); % moving the Figure to the center
axes('Units', 'Normalize',...
'position', [0 0 1 1],...
'color', 'w');
img = imread('~~~.jpg');
imshow(img);
axis equal; % for setting the aspect ratio to equal so the figure appears correctly!
set(Figure, 'Visible', 'on');
pause(3); % pause the splashscreen for 3 seconds
close(Figure); %closing the figure
  3 件のコメント
Ankit
Ankit 2019 年 11 月 19 日
Thank you Adam :)
"end" was copying mistake from my code!
Adam Danz
Adam Danz 2019 年 11 月 19 日
Looks good! +1

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by