SO503 Intro to Matlab Programming

General academic tips

Lab 1: Excel Programming

Lab 2: Matlab Programming

As we repeat Lab 1, you should understand the problem, and how you need to tackle it.  The job is to figure out how to do that in Matlab.

Lab 3: GIS does lab 1

Lab 4.  Matlab Wind

Lab 5.  Cross correlation

Find the max in a vector, and where it occurs (if you just need the max, Matlab does it very easily):

%set the max so low it will definitely be higher

MaxTemp = -99999; 

for i=1:length(Temps)     %array to search form the max

   if Temps(i) > MaxTemp

      MaxTemp = Temps(i);

     TimeMaxTemp = TempTime(i);



Getting N-S Wind components:

   WindComp = WindSpeed * trig(deg2rad*WindDir)); 

Do we need to put this in a loop?

Getting other wind direction components: +/- an angle, which moves it to "north" where you can use the code above

Reading a text file:

Reading and processing an ASCII  data file, general process:

Comparing strings: Matlab might be fussy about using the "==" operator to test for string equality.  In this case you can use the strcmp function.

Pretty printing or in Matlab-speak, smart indenting from the right click on a block of highlighted code.

Logic in processing CTD data

last revision 4/19/2017