% Derrick Roos
% 
% viewer.m takes in output from LF_network and plot voltage traces of all
% the cells. If you wish to only look at one cell enter that as a
% 2nd input.
%
% viewer(v_ex,v_in,cell_trace)

function viewer(v_ex,v_in,cell_trace)

[cells,timesteps,comps] = size(v_ex);
if nargin == 2
figure;
step = 200;
hold on
for k = 1:cells
    
    plot(0.01*(1:timesteps),v_ex(k,:,1)+ k*step)
    plot(0.01*(1:timesteps),v_in(k,:,1)+ k*step,'r')
    title('Voltage Trace of all cells')
end

else
     plot(0.01*(1:timesteps),v_ex(cell_trace,:,1))
     hold on
       plot(0.01*(1:timesteps),v_in(cell_trace,:,1),'r')
     title(['Voltage Trace of Cell ' num2str(cell_trace)])
end
    
legend('Excitatory','Inhibitory Companion')