% Jon Newman
% 07 April 2010

% This script loads and plots a segment of conintuous HEKA data

fid = '20100629_3-19.mat';
loc = 'C:\Documents and Settings\Annihilatrix II\Desktop\HEKA_20100629\';
trange = [500 800]; % in seconds
data = load(strcat([loc fid]));
N = 5; % number of plot rows

datid = fieldnames(data);
if length(datid) == 1
    dat = data.(datid{1});
end

time = dat(:,1);
ord = 10e11*dat(:,2);

[temp t1] = min(abs(time-trange(1)));
[temp t2] = min(abs(time-trange(2)));

seglen = floor(length(time)/N);

figure()
x = time(t1:t2)-time(t1);
y = ord(t1:t2);
plot(x,y,'k');
ylabel('$I_{mem} (pA)$','Interpreter','latex');
ylim([-1100 100])
xlim([min(x) max(x)]);
title(fid,'Interpreter','none');
xlabel('$Time (s)$','Interpreter','latex');
