How to create a uipanel in GUI without guide?

2 ビュー (過去 30 日間)
Carlos HM
Carlos HM 2018 年 6 月 24 日
コメント済み: Stephen23 2018 年 6 月 24 日
I am trying to add a uipanel in a GUI without guide with the following code:
function simpleGui
handles.fig=figure('position',[50 50 1350 600])
handles.uipanel3=uicontrol('style','uipanel','position',[10 10 100 40],'string','Panel');
But I get the following error:
Error using uicontrol 'uipanel' is not a valid value. Use one of these values: 'pushbutton' | 'togglebutton' | 'radiobutton' | 'checkbox' | 'edit' | 'text' | 'slider' | 'frame' | 'listbox' | 'popupmenu'.
Error in simpleGui (line 3) handles.uipanel3=uicontrol('style','uipanel','position',[10 10 100 40],'string','Panel');
Thank you for your help.
  1 件のコメント
Stephen23
Stephen23 2018 年 6 月 24 日
The uicontrol help page does not mention uipanel anywhere as being a Style option.
Using [a major internet search engine] returns this page as the first result:
Have you tried using a uipanel ?

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

回答 (2 件)

Ameer Hamza
Ameer Hamza 2018 年 6 月 24 日
If you want to create a panel, you need to use uipanel() function. Try
handles.fig=figure('position',[50 50 1350 600])
handles.uipanel3=uipanel('position',[0.1 0.1 0.5 0.4],'Title','Panel');
Also, note that by default the uipanel() use normalized units.

Image Analyst
Image Analyst 2018 年 6 月 24 日
You can use GUIDE's successor, App Designer.

カテゴリ

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