Matlab Examples -- BE-205


 

File

Description

Set 0

program.m

A sample Matlab program script. Demonstrates proper internal documentation.

template.m

A sample Matlab function script. Demonstrates function structure and proper internal documentation.

Set 1

tconv.m

Interactive, console program for converting temperatures from Fahrenheit to Kelvin.

guitconv.m

Interactive, GUI program for converting temperatures from Fahrenheit to Kelvin.

functconv.m

Interactive, console program for converting temperatures from Fahrenheit to Kelvin using a function.

f2k.m

A function for converting temperatures from Fahrenheit to Kelvin. Uses NaN for error control. Used by functconv.

Set 3

varargdemo.m

Variable number of arguments demonstration. Uses a cell array.

dialogDemo.m

Graphical dialog demonstration. Uses built in inputdlg, msgbox, uiwait and menu functions. Uses a switch construct.

lab1.m

My solution to laboratory assignment 1. Uses graphical dialogs, cell arrays and a function call to calculate the pressure of a specified gas given its molar volume temperature.

vdweqs.m

Function used by lab1.m. Implements van der Waals equation of state.

Set 4

why.m

MSOE customized version of why.

patientData.m

Simple patient database script that demonstrates structures and while and for loops. No error control. Doesn't really do anything. Revised & corrected (1/12/07) version.

Set 5

clickMeEx.m & clickMeEx.fig

My very simple first GUI example.

MyFirstGUI.m & MyFirstGUI.fig

Chapman's (your book's) first GUI example. Uses a persistent variable. See also my FirstGUINotes.pdf handout.

MyFirstGUI3.m & MyFirstGUI3.fig

My "improved" version of Chapman's first GUI example. Stores state in a user-defined property in the handles structure. See also the setappdata and get appdata functions. See also my MyFirstGUI3Notes.pdf handout.

Midterm 1 Programs

c2p.m, plotChange.m and equipData.m.

Set 6

numberReformatter.m & numberReformatter.fig

Reformats an entered value. Demonstrates the use of edit boxes for numeric input and push buttons to cause program actions. See documentation file (numberReformatter.pdf) for more information.

mapCalc.m & mapCalc.fig

Calculates the mean arterial pressure (MAP). Demonstrates the use of edit boxes for input, static text for output and push buttons. Edit boxes are disabled after calculation of MAP. See documentation file (MAPCalculator.pdf) for more information.

sandwichDemo.m & sandwichDemo.fig

Allows a user to specify sandwich ingredients. Demonstrates the use of check boxes, static text and pushbuttons. An external function is use to send output is sent to command window to simulate the hardware control applications. See documentation file (SandwichCheckBoxExample.pdf) for more information.

Set 7

delayedGroupDemo.m & delayedGroupDemo.fig

Allows user to specify the color of a panel using radio buttons. Demonstrates the use of radio buttons, push buttons and panels. Panel doesn't change color until a push button is clicked. State of buttons are determined directly in push button callback. See documentation file (DelayedGroupDemo.pdf) for more information.

instantGroup.m & instantGroup.fig

Allows user to specify the color of a panel using radio buttons. Demonstrates the use of radio buttons, push buttons and panels. Panel changes color immediately when radio button selections change. State of buttons are determined in group box's selection change function (_SelectionChangeFcn). See documentation file (InstantGroupDemo.pdf) for more information.

groupDemo.m & groupDemo.fig

Allows user to specify the color of a panel using radio buttons. Full version of previous group box demonstrations. Demonstrates use of radio buttons, push buttons and panels in the context of a fully implemented GUI. States of GUI controls are saved as properties in the handles structure. See documentation file (ButtonGroupDemo.pdf) for more information.

Set 8

mathDrill.m & mathDrill.fig

Presents the user with a series of simple arithmetic problems. Demonstrates the use of popup menus, random number generation, the GUIDE opening function (_OpeningFcn) and string building (the sprintf function). See documentation file (popupMenuMathDemo.pdf) for more information.

listMathDemo.m & listMathDemo.fig

Presents the user with a series of simple arithmetic problems. Demonstrates the use of list boxes, random number generation, the GUIDE opening function (_OpeningFcn) and string building (the sprintf function). See documentation file (listBoxMathDemo.pdf) for more information.

sliderDemo.m & sliderDemo.fig

Allows the user to specify the color of a panel using three sliders (one each for the red, green and blue components). Demonstrates the use of sliders and color panels. See documentation file (sliderDemo.pdf) for more information.

Set 9

barStrength.m & barStrength.fig

Midterm 2, Part 2 Problem Solution. Demonstrates the use of edit boxes, pushbuttons and radio buttons. See test key (MT2p2key.pdf) for more information.

gasDemo.m, gasDemo.fig & gas.mat

Demonstrates how to initialize a GUI using data stored in a .mat workspace file. Uses a popup menu and a static text box. See documentation file (MoleWeightDemo.pdf) for more information.

 


Send comments and suggestions to: Dr. Charles S. Tritt
This page last updated 12/5/07