% David E. Haddad
% July 2008

% This script will load a three-column matrix and return
% the maximum and minimum elements in each column.

% IMPORTANT NOTE: You cannot use MATLAB's "load" command if your original data text
% file has a header.  MAKE SURE YOU DELETE THE HEADER!

% here we go...

% CHANGE THIS TO YOUR FILE'S NAME:
xyz_data = load('input_filename.txt');

x = xyz_data(:,1);
y = xyz_data(:,2);
z = xyz_data(:,3);

% Maximum values
[max_x, idx_max] = max(x(:));  % find maximum value of x, idx is the index.
[max_y, idy_max] = max(y(:));  % find maximum value of y, idy is the index.
[max_z, idz_max] = max(z(:));  % find maximum value of z, idz is the index.

%Minimum values
[min_x, idx_min] = min(x(:));  % find minimum value of x
[min_y, idy_min] = min(y(:)); % find minimum value of y
[min_z, idz_min] = min(z(:));  % find minimum value of z

% Display maximum and minimum values
maximum_x = max_x
minimum_x = min_x

maximum_y = max_y
minimum_y = min_y

maximum_z = max_z
minimum_z = min_z






