clear
close all
f=figure(3);
tiledlayout(5,1);
PWD=pwd;
cd ..
cd('Output CSVs')
DataSets={'Fig3A','Fig3B','Fig3C','Fig3D','Fig3E'};
TitleName={'Sensory stimulation (awake)','GABAergic interneurons OG (awake)',...
    'Sensory Stimulation (anesthesia)','GABAergic interneurons OG (anesthesia)',...
    'Pyramidal neurons OG (anesthesia)','A)','B)','C)','D)','E)'};
PlotFlags=[2000,2000,2500,4500,4500];
for i=1:length(DataSets)
    nexttile%subplot(5,1,i)
    T=readtable(strcat('sten2020_NVC_main_data_',DataSets{i},'.csv'));
    %Time is Column 1, Signal is Column 2, Dilation variable is column 13
    PlotData=table2array(T(:,[1,2,13]));
    plot(PlotData(1:PlotFlags(i),1),PlotData(1:PlotFlags(i),3),'r-')
    hold on
    plot(PlotData(1:PlotFlags(i),1),PlotData(1:PlotFlags(i),2)-10,'k-')
    ylabel('\Delta Dilation (%)','FontSize',10)
    title(TitleName{i},'FontSize',10,'FontWeight','Bold')
    ylim([-11 20]);
    xlim([0 45])
    yticks(-5:5:15)
    xticks(0:10:40)
    if i==1
        legset=legend('Best Model Simulation','Neuronal Stim');
    end
    if i==5
        xlabel('Time (Seconds)','FontSize',10)
    end
    text(-7,5,TitleName{i+5},'FontWeight','Bold')
end
cd(PWD)
set(gcf,'Position',[100 100 400 700])
exportgraphics(f,'Figure3.png','Resolution',600)