% This code deals exclusively with ATMO 529, HW#3 precipitation data. % % DESCRIPTION: % Reads in precipmonthly_usmx.asci and partitions data into a 3D-cell/ % matrix array for use. % % INPUT VARIABLES: % precip - the ascii text file being read in % % OUTPUT VARIABLES: % P(i,j){k} - The 3D cell array that will be used throughout the % assignment % % Coded by: Stephen Bieda III % Date: 09/17/2007 % E-mail: bieda@atmo.arizona.edu % Load the file into the database and save it as a variable. load precipmonthly_usmx.asci precip = precipmonthly_usmx; clear precipmonthly_usmx; count = 1; % Allocate memory to create the cell array. P = cell(81,51); % Save the database as a 3D cell array. for k = 1:660; for j = 1:51; for i = 1:81; P{i,j}(k) = precip(count); count = count + 1; end end end % Allocate memory for the necessary mean and standard deviation meanp = zeros(81,51); stdp = zeros(81,51); % Calculate mean and standard deviation. for i = 1:81; for j = 1:51; q = find(P{i,j}~= -999.9); meanp(i,j) = mean(P{i,j}(q)); stdp(i,j) = std(P{i,j}(q),1); end end