Download Icon
Transcript
that each of them have different purposes. These are; hObject, eventdata and handles. If each of them is not used in the ‘callback’ function the guide will put an underline warning sign on each of them. hObject: This variable handles the event of current operating object or component which creates a ‘getcallbackobject’ called GCBO. In MATLAB, the GCBO are dynamically created each time when a callback is executed. Their functionality is to get handle to current callback object [OBJECT, FIGURE] = GCBO and returns the handle of the object whose callback is currently executing and also the figure containing that object. [36] eventdata: The event data in MATLAB take event handlings data and pass throughout the platform. These are reserved for future version of MATLAB. handles: This method is the basic for MATLAB GUI events. When MATLAB creates a graphics object or component, it assigns an identifier to the object. [37] This identifier is called ‘handle’ and sometimes denoted as ‘h’. One can use the “handle” identifier variable to access the “hObject” properties with two built in functions called “set” and “get” functions. For example, the following quadratic statements create a graph and return an event data to a plot result object in a form of h: 𝑥 = 0: 0.1: 1 𝑦 = 2𝑥 2 + 𝑥 ℎ = 𝑝𝑙𝑜𝑡(𝑥, 𝑦) We can use the handle event handler h to set and get the properties of the ‘quadratic plot’ object. For example, we can set its fore ground colour property as: Set (h,'Color','red') We can also specify the properties when we call the plotting function in another M-script file: h = plot(x, y,'Color','red'); We can also get the object property by using a get function. And it will return the object and its possible values as numerical value which is an id for that component and its property. A= get (gcf,’Color’), where gcf returns the current figure, and it stands for get current figure. Will return ans= 0.2 0.2 0.1 This value is the combination of one of the MATLAB colour RGB. 50