15.11.2014 Views

Chapter 4: Programming in Matlab - College of the Redwoods

Chapter 4: Programming in Matlab - College of the Redwoods

Chapter 4: Programming in Matlab - College of the Redwoods

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

260 <strong>Chapter</strong> 4 <strong>Programm<strong>in</strong>g</strong> In <strong>Matlab</strong><br />

4.5 Subfunctions <strong>in</strong> <strong>Matlab</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379<br />

Call<strong>in</strong>g Functions From Script Files 380<br />

Subfunctions 383<br />

Add<strong>in</strong>g Functionality to our Program 385<br />

Complet<strong>in</strong>g rationalArithmetic.m 391<br />

Exercises 393<br />

4.6 Nested Functions <strong>in</strong> <strong>Matlab</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399<br />

Variable Scope <strong>in</strong> Nested Functions 400<br />

Graphical User Interfaces 403<br />

Button Groups and Radio Buttons 406<br />

Add<strong>in</strong>g a Function Callback to <strong>the</strong> UIButtonGroup 409<br />

Popup Menus 411<br />

Edit Boxes 415<br />

Appendix 418<br />

Exercises 422<br />

Answers 430<br />

Copyright<br />

All parts <strong>of</strong> this <strong>Matlab</strong> <strong>Programm<strong>in</strong>g</strong> textbook are copyrighted <strong>in</strong> <strong>the</strong> name<br />

<strong>of</strong> Department <strong>of</strong> Ma<strong>the</strong>matics, <strong>College</strong> <strong>of</strong> <strong>the</strong> <strong>Redwoods</strong>. They are not <strong>in</strong><br />

<strong>the</strong> public doma<strong>in</strong>. However, <strong>the</strong>y are be<strong>in</strong>g made available free for use<br />

<strong>in</strong> educational <strong>in</strong>stitutions. This <strong>of</strong>fer does not extend to any application<br />

that is made for pr<strong>of</strong>it. Users who have such applications <strong>in</strong> m<strong>in</strong>d should<br />

contact David Arnold at david-arnold@redwoods.edu or Bruce Wagner at<br />

bruce-wagner@redwoods.edu.<br />

This work (<strong>in</strong>clud<strong>in</strong>g all text, Portable Document Format files, and any o<strong>the</strong>r<br />

orig<strong>in</strong>al works), except where o<strong>the</strong>rwise noted, is licensed under a Creative<br />

Commons Attribution-NonCommercial-ShareAlike 2.5 License, and is copyrighted<br />

C○2006, Department <strong>of</strong> Ma<strong>the</strong>matics, <strong>College</strong> <strong>of</strong> <strong>the</strong> <strong>Redwoods</strong>. To<br />

view a copy <strong>of</strong> this license, visit http://creativecommons.org/licenses/by-ncsa/2.5/<br />

or send a letter to Creative Commons, 543 Howard Street, 5th Floor,<br />

San Francisco, California, 94105, USA.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!