How to get a small GUI window figure which is saved before?

조회 수: 2 (최근 30일)
Luna
Luna 2018년 11월 27일
편집: Luna 2018년 11월 27일
Hello !
I have created a GUI with my own code. In my GUI, I have 2 buttons: Add New and Edit.
When clicked on Add New, there is another Mini GUI opens and asks for details of the user going to be added.
After adding a new user, the user appears in the table, I also save them by their names under a struct behind. (struct fieldnames will be unique so no worries)
When clicked on a user in the table, and then click edit, I want to open the same mini GUI with the informations filled with corresponding user infos on uicontrol elements.
I really appreciate your help on this problem. Thanks!!
Note: The codes are attached. runApp.m runs the GUI.

채택된 답변

Rik
Rik 2018년 11월 27일
You can edit the addNewUserGUI function to accept pre-filled information. You can use this to set the Value parameter of each dropdown to the appropriate selection value.
  댓글 수: 3
Rik
Rik 2018년 11월 27일
If you store your objects under the same name as your input struct field names, you can simply loop over them:
%suppose the objects being stored as handle.miniGUI.Name, handle.miniGUI etc
object_list=fieldnames(userInfoInput);
for n=1:numel(object_list)
%You could also use ismember to figure out the Value by retrieving the
%list of element first.
set(handle.miniGUI.(object_list{n}),'Value',userInfoInput.(object_list{n}))
end
Luna
Luna 2018년 11월 27일
편집: Luna 2018년 11월 27일
Works like a charm!
I used to loop through the dropdown menu string cell to get location of the element that I am looking for. ismember is my fav function now.
Thanks Rik! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by