Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 1.3 KB

readme.md

File metadata and controls

16 lines (10 loc) · 1.3 KB

Week 3

This week, we are going to discuss a few things that a really important to programming, regardless of the specific programming language (Fortran, Python, Matlab, R, and so on...)

Programming Flow Control

First, we will talk about flow control. In a general sense, flow control has to do with how (in what order, etc.) statements in a piece of code are evaluated. One might think that codes execute in a sequential way (line 1, line 2, and so on) but that is not always the case.

So, let's start off by opening up class3_1.mlx. Note that this is a live script, and not a regular m-file.

Next, let's have you do this example exercise before we continue.

Functions

A function is simply a piece of code that performs a certain task. Matlab is full of zillions of 'built-in' or 'included' functions. Sometimes, however, you may wish to write your own function. A well-written function is one that is clearly documented so that the user can understand inputs, outputs, and so on.

Let's tackle this topic by opening up class3_2.m. Note that this will make use of several additional .m files that are in the repository.

And, we'll finish off today's class by having you do this example.