Introduction to creating GUI using MATLAB

In this post I’ll be talking about MathWorks MATLAB software and how one can create GUI’s using the software. This GUI creation has been made really simple in MATLAB.

Introduction

MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyse data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spread sheets or traditional programming languages, such as C/C++ or Java. You can use MATLAB for a range of applications, including signal processing and communications, image and video processing, control systems, test and measurement, computational finance, and computational biology. More than a million engineers and scientists in industry and academia use MATLAB, the language of technical computing.

This paragraph is what is given on their website. So MATLAB is a very versatile software. One can use it for many applications. We learnt MATLAB as a part of our curriculum. We learnt how to make graphs, make simple programs, analyse LTI systems using MATLAB. But recently I learnt how to make GUI using MATLAB because my project needed this. So here I am sharing my knowledge with you all.

GUI

GUI stands for a graphical user interface. This is nothing but a graphical utility that is used to make the life of a common user easier. A graphical user interface takes inputs as mouse clicks and others. Let me give you an example. Those of you who are familiar with present day LINUX operating system have seen the windows/apple like interface. But earlier there used to be a command prompt like terminal in LINUX. Here one had to type in list of commands for performing any task. So if you want to see the calendar you needed to type in the command related to the same. But now there is a GUI available for it. Behind the scene there is extensive coding done so that the user does not have to be a coder in order to use the system. So this was an example of GUI’s making our life easier.

Now let us discuss the scope of GUI’s in our micro controller based projects. There is a huge scope for GUI’s here. For example you can make a GUI that could have just two buttons one Red LED and the other Green LED. You could program it in such a way that whenever you pressed this button the corresponding LED on Launchpad will glow. This is just a simple example you can take this to the next levels by making real time graphs using MATLAB. For example there is a sensor that is collecting data and sending it serially to your computer. You can plot real time graphs of that data and do manipulations on that data. This is the signal processing part. This can be easily done using MATLAB.

Steps for creating a GUI

Step 1: Open MATLAB

Step 2 : New—> Graphical User Interface

Step 3 : Select blank GUI

Step 4 : Create your own GUI using the palette available on the left hand side (for more details view the video tutorial.)

Step 5 : Save the file as ‘.fig’. After this step the ‘.m’ file of your GUI will automatically open in front of you.

Video

For more details refer the documentation provided in MATLAB and http://www.mathworks.in/