BASIC INTRODUCTION TO MATLAB
 

Basic Arithmetic
Trigonometry
Logarithms and Exponentials
Variables
Retrieving Variable Values
Saving and Loading
Recording Your Steps
Helpful Links
Recording Your Steps
How to Examples
How to:
If you want to save more than just your variables, namely a step-by-step recording of the commands you input and the output you receive, you need to use the diary function:
     diary YourFileName -
saves your commands in the filename of your choice
     diary off - turns recording off
     diary on - turns recording back on

If you are using MATLAB to do your homework, even to the extent of printing our your commands and handing them in, you'll probably want to use the diary function. However, sometimes when you are writing out your homework on paper, you might go to a separate piece of scratch paper to do little computations that don't matter much. This is when you would want to utilize the diary off function, to stop recording when you are doing things that aren't really that important to the assignment. Then just use diary on when you are ready to commence again.


Examples:
So, let's see how we might go about using MATLAB to do our homework (and hand it in). We begin by turning the diary on and have it begin saving for us:
     diary HomeworkAssignment2

So, we complete the first few steps of the first problem. We then have to multiply 11*12. Not wanting to include this in what we hand into the professor we stop recording and compute:
     diary off
     11 * 12
     diary on