% Scan Integral

startIP      = -7.5
stepIP       =  0.1
endIP        = -4.5
startCanum   = 0
stepCanum    = 100
endCanum     = 25000
plot_length  = 20001;
TransPeakRow = 5021;

table = zeros((ceil(-(endIP-startIP)/stepIP) + 1)*(ceil((endCanum-startCanum)/stepCanum) + 1), 4);

i = 1;
for nowIP = startIP:stepIP:endIP
    for nowCanum = startCanum:stepCanum:endCanum
        table(i,1)   = nowIP;
        table(i,2)   = nowCanum;
        CaTimeCourse = load(strcat('CaRes_IP3', num2str(nowIP), 'Canum', int2str(nowCanum), '_Ca.plot'));
        [row col]    = size(CaTimeCourse);
        table(i,3)   = CaTimeCourse(TransPeakCol,col);            % Transient Ca2+ Peak
        table(i,4)   = sum(CaTimeCourse(5001:10001,col)) / 5001;  % Averaged Ca2+ Response
        i = i + 1;
        end
    end

    savefullname = strcat('AveCaRes_IP', num2str(startIP), '_', num2str(stepIP), '_', num2str(endIP), 'Canum',int2str(startCanum), '_', int2str(stepCanum), '_', int2str(endCanum), '.txt')
    save(savefullname,'table','-ASCII')
