function [membranPotAVG]=avgPerFrame ... (membranePot,ttls_ms) %function [membranPotAVG]=avgPerFrame ... % (membranePot,ttls_ms) %builds the average membrane potential between frames for the white noise % -> same principle for frozen frames % INPUT: membranePot -> membrane Potential % ttls_ms -> pulses in ms % OUTPUT: membranPotAVG -> average membrane potential per frames membranPotAVG=zeros(1,length(ttls_ms)-1);%preallocate %make the average membrane potential between two stimulus frames for jj=1:length(ttls_ms)-1 membranPotAVG(jj)=mean(membranePot(ttls_ms(jj) ... :(ttls_ms(jj+1)-1)));%detail: -1ms because the next ms is already the start of the new stimulus frame end end