pop up menu & push button

2 ビュー (過去 30 日間)
Pneu  94
Pneu 94 2020 年 5 月 25 日
コメント済み: Rik 2020 年 5 月 25 日
Hi, I'm new in Mathwork, i have this line in matlab gui, but i want to use ''String" instead of "Tag'', The "String" contains many choices (pop up menu), and i don't know what i should change.
comp =num2str(get(findobj('Tag','capacitor'),'Value');
Thanks in advance
  2 件のコメント
Rik
Rik 2020 年 5 月 25 日
What do you want to achieve? It sounds like you want to achieve something different than the required edit in your code.
Pneu  94
Pneu 94 2020 年 5 月 25 日
i want to make a condition:
1- chose something in popmenu1,
2-chose sth in popmenu2,
3- clic in push button
4- open new gui

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

回答 (1 件)

Rik
Rik 2020 年 5 月 25 日
編集済み: Rik 2020 年 5 月 25 日
You can retrieve the selections like this
String1=get(handles.popmenu1,'String');
Selection1=String1{get(handles.popmenu1,'Value')};
String2=get(handles.popmenu1,'String');
Selection2=String2{get(handles.popmenu2,'Value')};
if strcmp(Selection1,'foo') && strcmp(Selection2,'bar')
%do something
else
%do something else
end
Side note: you should probably move away from GUIDE if you're creating a GUI. It hasn't been great for the past few years, maybe ever. Check out this thread: https://www.mathworks.com/matlabcentral/answers/483657-how-to-create-a-gui.
  2 件のコメント
Pneu  94
Pneu 94 2020 年 5 月 25 日
the function in which a must write that is that of the push button?
Rik
Rik 2020 年 5 月 25 日
Yes. Unless you want this to happen after you select something in the popup menu.

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by