Archive for October, 2007

Basic, GUI, MATLAB

Matlab GUI Tutorial - Plotting Data to Axes

Introduction

Matlab LogoIn this Matlab GUI tutorial, you will learn how to create and use the Axes component. The Axes component allows you to display graphics, such as graphs and images on your GUI. In this tutorial, we will create two axes on the GUI and plot some simple data onto it. In addition, we will include a reset button to clear the axes and we will also add the standard toolbar to allow the user to zoom, pan, and query the plot. Continue Reading »

Pages: 1 2

Basic, GUI, MATLAB

Matlab GUI Tutorial - Pop-up Menu

Introduction

Matlab LogoIn this Matlab GUI tutorial, you will learn how to create and use the Pop-up Menu component. Pop-up menus are used as a control for choosing between a set of options. When the user clicks on the Pop-up menu, the menu expands, revealing a set of choices that the user can pick. A common use for Pop-up menus is a font size selector (shown below).

Pop-up Menu Expanded
Continue Reading »

Pages: 1 2

Basic, GUI, MATLAB

Matlab GUI Tutorial - Slider

Introduction

Matlab LogoIn this Matlab GUI tutorial, you will learn how to create and use the slider component. Sliders are useful controls for choosing a value in a range of values. Common uses are volume controls, seekers for movie and sound files as well as color pickers. An example of a slider is shown below.

Slider GUI

This tutorial is written for those with little or no experience creating a Matlab GUI (Graphical User Interface). If you’re new to creating GUIs in Matlab, you should visit this tutorial first. Basic knowledge of Matlab is not required, but recommended. Matlab version 2007a is used in writing this tutorial. Both earlier versions and new versions should be compatible as well (as long as it isn’t too outdated). Let’s get started!

Create the Visual Aspect of the GUI

  1. Start up Matlab, and type guide in the command line.
    command prompt

  2. Choose to create a new GUI using the "Blank GUI(Default)" option.
    blank GUI

  3. Click on edit text icon and add an Edit Text component to the GUI figure. Next, click on slider icon and add a Slider component onto the GUI figure.

  4. Double click the Edit Text component to bring up the Property Inspector. Change the String property to 0, and change the Tag property to sliderValue_editText as shown in the figure below:
    Modify edit text component properties

  5. Next, let's modify the properties of the Slider component. First lets sit the Min property to 0, and the Max property to 100. Next, change the Tag property to slider1.
    Modify slider component properties

  6. Here’s what your figure should look like after you add the components and modify them.
    What your figure should look like

  7. At this point, you also might want to add some Static Text components to specify the min and max values of the slider. You can modify their text by double clicking on the component and changing the String property. It's not required, but I highly recommend it.

    Add on limits

  8. Save your GUI wherever you please with your desired filename.

Pages: 1 2

Basic, MATLAB

Matlab - Parsing Data Files With Header Content

Part 1: Preparing Data Set to be Read Into Matlab

Matlab Logo Often times in Matlab we would like to read data from a *.txt file. The importdata function is convenient as long as you don't have text or an inconsistent number of columns in your data set. However, if you're dealing with large volumes of data, it is inconvenient to delete the header content by hand. One option is to use php to automatically remove the contents in all your files. However, most data sets that are generated from data acquisition systems will usually put header content that provide key information on measurement parameters such as: number of points, sampling rate, etc. Thus, we need to be able to extract this key information as well! In this tutorial I will show you how you can easily read in data files with header content. Continue Reading »

Pages: 1 2 3

Basic, GUI, MATLAB

Matlab GUI (Graphical User Interface) Tutorial for Beginners

Introduction

Matlab LogoWhy use a GUI in Matlab? The main reason GUIs are used is because it makes things simple for the end-users of the program. If GUIs were not used, people would have to work from the command line interface, which can be extremely difficult and fustrating. Imagine if you had to input text commands to operate your web browser (yes, your web browser is a GUI too!). It wouldn’t be very practical would it? In this tutorial, we will create a simple GUI that will add together two numbers, displaying the answer in a designated text field.

Launching GUI from Command Prompt

This tutorial is written for those with little or no experience creating a Matlab GUI (Graphical User Interface). Basic knowledge of Matlab is not required, but recommended. Matlab version 2007a is used in writing this tutorial. Both earlier versions and new versions should be compatible as well (as long as it isn't too outdated). Lets get started!


Initializing Guide (GUI Creator)

  1. First, open up Matlab. Go to the command window and type in guide.

    Command Window

  2. You should see the following screen appear. Choose the first option Blank GUI (Default).

    GUI options

  3. You should now see the following screen (or something similar depending on what version of Matlab you are using and what the predesignated settings are):

    Guide Editor

  4. Before adding components blindly, it is good to have a rough idea about how you want the graphical part of the GUI to look like so that it'll be easier to lay it out. Below is a sample of what the finished GUI might look like.

    Sample GUI

Pages: 1 2 3 4 5

Next »