How can i use the GUIDE to create an interface to an existing program?

조회 수: 2 (최근 30일)
Uriel Rojo Martinez
Uriel Rojo Martinez 2018년 6월 26일
댓글: yong yang 2019년 1월 10일
In my school, my programming's teacher helps me to create a script to calculate the area of a square, Now he request me to do a GUI for that scrip. So, how can i start?
  댓글 수: 1
Rik
Rik 2018년 6월 27일
Did my answer help you? I would welcome feedback on any part that is unclear, so I can clarify/expand.

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

답변 (2개)

Rik
Rik 2018년 6월 26일
I would suggest you don't use GUIDE, but instead write the creating code yourself. My small guide to avoid GUIDE:
  • Make a figure (with f=figure;) and look into the doc for figure which properties you want to turn off (you probably want to set Menu and Toolbar to 'none')
  • Create buttons and axes and everything you need with functions like uicontrol and axes. Save the handles to each element to fields of a struct (like handles.mybutton=uicontrol(_);)
  • When you've finished loading all data (and saving it to fields of your handles struct), and creating all the buttons, save your handles struct to the guidata of your figure like this guidata(handles.f,handles);. (You can also use getappdata and setappdata)
  • You can set the Callback property of many objects. If you do, use a function name with an @ in front, or a char array that can be evaluated to valid code. (like @MyFunction or 'disp(''you pushed the button'')')
  • Callback functions will be called with two arguments: the first is a handle to the callback object, the second is eventdata that may contain special information. To get access to your data, just use handles=guidata(gcbo);. You can replace the gcbo function with the name of the first input to your callback function if you prefer.
  • More information about callbacks can be found in multiple places in the doc, for example here.
  댓글 수: 1
yong yang
yong yang 2019년 1월 10일
After several days of research, although GUIDE is very convenient for creating GUI, but it also has certain limitations, such as: unable to recognize nested functions, etc., but this is also part of the work for graduation thesis.

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


yong yang
yong yang 2019년 1월 10일
thank you for your help ,I will try it.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by