function ep1mcplook(NumOfDays) % EP1MCPLOOK - Opens and graphs the file /oasis/eqpac/ep1/mcp % Peter Strutton % 22 Dec 1998; Brian Schlining % Prompt for input if no input arguments are specified if ~nargin NumOfDays = str2num(input('How many days of data would you like to view? ','s')); end % Set the path to the data file depending on what type of machine this function is run from switch computer case 'PCWIN' % Assumes the pwd is /oasis/epqac/brian/ %FileLoc = ['..\ep1\mcp']; FileLoc = ['//tsunami.shore.mbari.org/oasis/eqpac/ep1/mcp']; otherwise % Assigns an absolute path in UNIX FileLoc = ['/hosts/tsunami/oasis/eqpac/ep1/mcp']; end loc = '0 155W'; % Open and read the file fid = fopen(FileLoc,'r'); OK = 1; while OK % Trash the header S = fgetl(fid); if ~strcmp(S(1),'#') break end end i = 1; while ~feof(fid) % Read the data XS = fgetl(fid); % Get a line from the file X(i,:) = sscanf(XS,'%f')'; % Read the data from the line i = i + 1; end fclose(fid); [rX cX] = size(X); % Get it's size D = dy2date(X(:,1)+1900); % Convert decimal years to serial date numbers DEnd = max(D); % Get the last date i = find(D >= (DEnd - NumOfDays)); % Find all dates within specified period % Create the graph figH = figure; set(figH,'Name','MCP; 10m & 30m') j = find((X(i,2) == 10)); % Skip rows of data with NaN's k = find((X(i,2) == 30)); % Skip rows of data with NaN's aH = plotyy(D(i(j)),X(i(j),3),D(i(k)),X(i(k),3)); %set(aH(1),'XLim',[min(X(:,1)) now],'XTick',[]); set(aH(1),'XTick',[]); set(figH,'CurrentAxes',aH(1)) ylabel('10m MCP output [volts]'); set(figH,'CurrentAxes',aH(2)) set(aH(1),'XTick',[]) ylabel('30m MCP output [volts]'); xlabel('Date'); title(['MCP output in volts at 10m & 30m for ' loc]); %set(aH(2),'XLim',[min(D(i,1)) now]) %hold on if NumOfDays < 40 dtick = 6; else dtick = 3 end datetick('x',dtick) XLim = get(aH(2),'XLim'); set(aH(1),'XLim',XLim) setfontsize(7)