Matlab Graphical User Interface Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

GUI (Graphical User Interface) is a pictographic form interfaced with a program. A good GUI facilitates the user to use and provide them a reliable appearance. By performing any action, The GUI should behave in an understandable and predictable manner .For example when the user click on "exit" pushbutton the GUI should perform action associated to it i.e. exit from GUI. The GUI provides a familiar environment to the user to work e.g. pushbuttons, toggle buttons, lists, menus, text boxes etc, to which the user is already familiar [12]. The GUIs are a bit harder to program because a GUI must be prepared for mouse click or Keyboard input for any GUI element, these types of inputs are called events, and the program witch respond to that event is said to be event driven.

4.2 MATLAB Graphical User Interface:

The tool used to develop a GUI in MATLAB is called "guide" (the GUI Development Environment).Using this tool programmer can develop the layout of the GUI by placing the required components in it i.e. pushbuttons, labels, edit boxes, axes etc, these components are also called Graphic Components because these components include graphical controls. After placing these components the programmer can change their properties i.e. name, color, size, font, text to display vice versa. By writing 'guide' in the command window the GUI Development Environment or Layout editor will open in a new window as shown in the figure 4.1.

Figure 4.1

In the figure 4.1 the large white area with grid lines is the layout area where the GUI layout is developed. On the left side of the layout area their is palate of GUI components, by clicking and dragging the desired component into the desired layout area a programmer can create any number of GUI components. On the top a toolbar with useful tools that facilitate the user to align GUI components, as well as edit properties of GUI components and add menus to GUIs.

4.3 Reason to choose MATLAB GUI:

The reasons to choose to develop GUI in MATLAB GUI application are as follow:

High level script base development

Its user interactive and real time measurements

Its Operating system independent GUI application [3]

4.4 MATLAB GUI Tools:

To understand the features available used in MATLAB creating GUI some of the tools are listed below:

Handle graphics objects

UI Controls

GUIDE(Graphical, User Interface environment)

Global variables event handing, callback functions, timer [3]

4.4.1 Handle graphics object:

Graphics and visualization are implemented through these objects .By the properties of these objects we control the performance and emergence of graph .we can implement graph objects i.e. figure ,axes ,lines etc by calling MATLAB functions .MATLAB assigns handle to that object and by using set and get functions we can access the properties of the objects.[3]

4.4.2 UI Controls:

UI control means User Interface control objects. Through this UI control graphics objects is created and GUI is implemented through this. Behavior of each component can be changed through there properties. [3]

4.4.3 GUIDE (Graphical and user interface environment):

The MATLAB allow us to generate or create application without the help of graphic layout. GUI is developed in MATLAB tool called GUIDE. We can create GUI with help of tools available in GUIDE. To access GUIDE go to MATLAB command prompt and enter guide. [3]

4.4.4 Callback functions, timer, event handing and Global variables:

In MATLAB callback functions are used to handle events that take place in the user interface objects. For pushbutton there will be a callback function which comes into action when user interface or click with that button. Timers are used in real time function to calculate the time. Global variable are used in multiple functioned environment. Event handling is very important in GUI application to handle the user inputs events for example mouse or keyboard inputs or serial port inputs. [3]

4.5 The Components required in GUI simulation:

The GUI coding is a bit different from a simple M-file coding. The description of the components is given below:

4.5.1 Slider:

The slider allows selecting values between maximum and minimum values in a constant range and it depends on the position of the slider. When we drag the slider automatically its callback function is called. The value of the slider is updated in the "Value" variable. [4]

4.5.2 Axes

To show a graphical data in a GUI window the axes component is used and is created with help of axes function. [3]

4.5.3 Text field:

TO show some text in string form an object is used known as text field. By the text field properties the alignment of he string the size, font, color etc can be edited. Text field does not have a callback function. Through UI control text field is created. [4]

4.5.4 Pushbutton:

An object on which user can perform a specific function by clicking that object or by pressing a specific key assign to it. A call back is created on the back hand of that object to perform the specific function. The pushbutton is a very key object of any GUI. [2]

4.6 Serial Port programming:

In MATLAB to send data on the serial port, the serial port must be defined as below:

>>S = serial ('COM3','BaudRate', 9600,'DataBits', 8,'stopbits', 1);

The above line of code describes that the data to be sent on port COM3, the baud rate is 9600, there are 8 data bits and one stop bit. After that we have to send the command to open the port by fopen() function.

>>fopen(S);

The above functions are located in the ON button.

Now the port is ready to send the commands using fwrite() function.

>>fwrite(S,data);

In this line of code S is the object in object in which you have define the port and data is the command or serial data you want to transmit through serial Port.

When the sending data or commands procedure is finished now we have to close the serial port by fclose() function .Now we have also to delete the variable S using delete() function.

>>fclose(S);

>>delete(s);

The fclose() and delete() function is located in the OFF button to end the serial transmission.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.