Contents

Aaron Klapheck

% Read Excel file 23-Aug-08
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
The date and time: 26-Aug-2008 09:42:44 

Test Communicate to BS2

rows = 90; columns = 3; port = 'COM4';

[text, numbers] = GetBS2NumbersAndText(rows, columns, port);
    ByteOrder = littleEndian
    BytesAvailable = 0
    BytesAvailableFcn = 
    BytesAvailableFcnCount = 48
    BytesAvailableFcnMode = terminator
    BytesToOutput = 0
    ErrorFcn = 
    InputBufferSize = 512
    Name = Serial-COM4
    ObjectVisibility = on
    OutputBufferSize = 512
    OutputEmptyFcn = 
    RecordDetail = compact
    RecordMode = overwrite
    RecordName = record.txt
    RecordStatus = off
    Status = closed
    Tag = 
    Timeout = 10
    TimerFcn = 
    TimerPeriod = 1
    TransferStatus = idle
    Type = serial
    UserData = []
    ValuesReceived = 0
    ValuesSent = 0

    SERIAL specific properties:
    BaudRate = 9600
    BreakInterruptFcn = 
    DataBits = 8
    DataTerminalReady = on
    FlowControl = none
    Parity = none
    PinStatus = [1x1 struct]
    PinStatusFcn = 
    Port = COM4
    ReadAsyncMode = continuous
    RequestToSend = on
    StopBits = 1
    Terminator = LF

Error Checking

% Double check data size.
fprintf('The size of data = %4.0f x %1.0f \n \n', size(numbers))

% The following lines are used so that the fprintf commands will work.
text1 = cell2mat(text(1,1)); %Stores name for type of sensor data stored
text2 = cell2mat(text(2,1)); %Stores name for type of sensor data stored
text3 = cell2mat(text(3,1)); %Stores name for type of sensor data stored
% **(may need to change, add or delete text#)**

% These two lines are used to display all the data and labels each data
% column. The number of data columns depends on number of each type of
% measurement used.
fprintf('%s \t %s \t %s\n', text1, text2, text3) %**(may need to change)**
fprintf('%6.0f \t \t %5.0f \t \t %4.0f \n', numbers') %**(may need to change)**
The size of data =   90 x 3 
 
Location 	 PRRight 	 Temp(C)
     1 	 	    19 	 	   18 
     1 	 	    20 	 	   18 
     1 	 	    19 	 	   18 
     1 	 	    19 	 	   18 
     1 	 	   147 	 	   19 
     1 	 	   112 	 	   19 
     1 	 	    98 	 	   19 
     1 	 	   104 	 	   19 
     1 	 	    95 	 	   19 
     1 	 	   102 	 	   19 
     1 	 	    96 	 	   20 
     1 	 	   101 	 	   20 
     1 	 	    98 	 	   20 
     1 	 	    98 	 	   21 
     1 	 	   100 	 	   21 
     1 	 	   236 	 	   21 
     1 	 	   249 	 	   21 
     1 	 	   101 	 	   21 
     1 	 	   102 	 	   21 
     1 	 	    95 	 	   21 
     1 	 	   102 	 	   21 
     1 	 	    95 	 	   22 
     1 	 	   103 	 	   22 
     1 	 	   169 	 	   22 
     1 	 	   224 	 	   22 
     1 	 	   192 	 	   22 
     1 	 	   191 	 	   22 
     1 	 	    96 	 	   22 
     1 	 	    39 	 	   21 
     1 	 	    38 	 	   21 
     2 	 	    56 	 	   21 
     2 	 	    58 	 	   20 
     2 	 	    55 	 	   20 
     2 	 	    59 	 	   20 
     2 	 	    55 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    57 	 	   20 
     2 	 	    56 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    55 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    56 	 	   20 
     2 	 	    56 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    55 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    56 	 	   20 
     2 	 	    56 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    55 	 	   20 
     2 	 	    58 	 	   20 
     2 	 	    56 	 	   19 
     2 	 	    56 	 	   19 
     2 	 	    58 	 	   19 
     2 	 	    55 	 	   19 
     2 	 	    58 	 	   19 
     2 	 	    57 	 	   19 
     2 	 	    55 	 	   19 
     2 	 	    59 	 	   19 
     2 	 	    55 	 	   19 
     3 	 	    34 	 	   18 
     3 	 	    35 	 	   18 
     3 	 	    35 	 	   18 
     3 	 	    38 	 	   18 
     3 	 	    48 	 	   18 
     3 	 	    32 	 	   18 
     3 	 	    11 	 	   18 
     3 	 	    49 	 	   18 
     3 	 	    73 	 	   18 
     3 	 	    51 	 	   18 
     3 	 	    19 	 	   18 
     3 	 	    12 	 	   18 
     3 	 	    19 	 	   24 
     3 	 	    19 	 	   24 
     3 	 	    19 	 	   24 
     3 	 	    47 	 	   23 
     3 	 	    19 	 	   24 
     3 	 	    44 	 	   24 
     3 	 	    86 	 	   24 
     3 	 	    24 	 	   24 
     3 	 	    35 	 	   23 
     3 	 	    18 	 	   23 
     3 	 	    18 	 	   23 
     3 	 	    18 	 	   23 
     3 	 	    17 	 	   23 
     3 	 	    18 	 	   23 
     3 	 	    18 	 	   24 
     3 	 	    18 	 	   24 
     3 	 	    18 	 	   24 
     3 	 	    39 	 	   24 

Plot the Photoresister Data

% This module is designed to plot the time vs. light intinsity information.

% Because time information was not given we can assume that the readings
% are taken to be about one second appart.
t = [1:1:30];

% Set up photoresistor values for each location in seperate matricies.
PRRight = 200 - numbers(:,2);
PhotoResistorLoc1 = PRRight(1:30,1);
PhotoResistorLoc2 = PRRight(31:60,1);
PhotoResistorLoc3 = PRRight(61:90,1);


plot(t, PhotoResistorLoc1, '.', t, PhotoResistorLoc2, 'o', t, PhotoResistorLoc3, 'x'), ...
    xlabel('Time (sec)'), ylabel('Light Intinsity'), grid, ...
    legend('location 1', 'location 2', 'location 3','Location','Best'), ...
    title('Light Values Over Time in Three Locations')

Plot the Temperature Data

% This module is designed to plot the time vs. temperature information.

% Set up temperature values for each location in seperate matricies.
Temp = numbers(:,3);
TempLoc1 = Temp(1:30,1);
TempLoc2 = Temp(31:60,1);
TempLoc3 = Temp(61:90,1);


plot(t, TempLoc1, '.', t, TempLoc2, 'o', t, TempLoc3, 'x'), ...
    xlabel('Time (sec)'), ylabel('Temperature (C)'), grid, ...
    legend('location 1', 'location 2', 'location 3','Location','Best'), ...
    title('Temperature Over Time in Three Locations')