% ----------------------------------------
% EPS 131: Intro to Phys. Ocean. & Climate
% Laure Zanna, Feb 7, 2008
% Intro to Matlab, Part II
%-----------------------------------------
% Using scripts and not the command line
% MATLAB's built-in text editor is the best way to do it.
% name your file the suffix ".m"
% For example matlab_intro_session_2.m: take the average of 5 numbers
% Before starting to run the script at the prompt, you need to:
% Make sure to be in the directory where the script is
% 1. type: pwd at the prompt, it will show the current working directory
% 2. If you are not, change to the correct directory, for example type at the prompt
% cd C:\Applications\MATLAB7p1\work\EPS131\
% Now, at the prompt, type matlab_intro_session_2
% to run the script
% Define variables for the 5 numbers:
a = 5;
b = 10;
c = 15;
d = 20;
e = 25;
% now calculate the average of these and print it out:
five_number_average = (a + b + c + d + e) / 5;
five_number_average