function analyze_stored_controls(files_to_analyze,trials_to_remove,epoch_dividers,basic_pathname,parameter_colors,synapse_in_question,conjoined_filename) %loading the control files plain_controlmatrix=[]; for barbapapa=1:length(files_to_analyze) control_pathname=strcat(basic_pathname,files_to_analyze{barbapapa},'__controls'); temp_plain_controlmatrix=load(control_pathname); if ~isempty(trials_to_remove{barbapapa}) temp_plain_controlmatrix(:,trials_to_remove{barbapapa})=[]; end plain_controlmatrix=[plain_controlmatrix temp_plain_controlmatrix]; end controll=plain_controlmatrix; %a list of the variables, stored row-by-row, in the control figure (columns represent trials; everything is on one sheet) trials=controll(1,:); ITI=controll(2,:); temperature=controll(3,:); intensity_pre=controll(4,:); pulsedur_pre=controll(5,:); r_access_chanone=controll(6,:); r_input_chanone=controll(7,:); leak_chanone=-1*controll(8,:); %flipping it tot_charge_chanone=controll(9,:); intensity_post=controll(10,:); pulsedur_post=controll(11,:); r_access_chantwo=controll(12,:); r_input_chantwo=controll(13,:); leak_chantwo=-1*controll(14,:); %flipping it tot_charge_chantwo=controll(15,:); psc_o_prepre=controll(16,:); q_o_prepre=controll(17,:); lat_prepre=controll(18,:); ris_prepre=controll(19,:); decay_prepre=controll(20,:); asynch_prepre=controll(21,:); psc_o_prepost= controll(22,:); q_o_prepost=controll(23,:); lat_prepost=controll(24,:); ris_prepost=controll(25,:); decay_prepost=controll(26,:); asynch_prepost=controll(27,:); psc_o_postpre=controll(28,:); q_o_postpre= controll(29,:); lat_postpre=controll(30,:); ris_postpre=controll(31,:); decay_postpre=controll(32,:); asynch_postpre=controll(33,:); psc_o_postpost= controll(34,:); q_o_postpost=controll(35,:); lat_postpost=controll(36,:); ris_postpost=controll(37,:); decay_postpost=controll(38,:); asynch_postpost=controll(39,:); % control_variables={'trials' 'ITI' 'temperature' 'intensity_pre' 'pulsedur_pre' 'r_access_chanone' 'r_input_chanone' 'leak_chanone' 'tot_charge_chanone' 'intensity_post' ... % 'pulsedur_post' 'r_access_chantwo' 'r_input_chantwo' 'leak_chantwo' 'tot_charge_chantwo' 'psc_o_prepre' 'q_o_prepre' 'lat_prepre' 'ris_prepre' 'decay_prepre' 'asynch_prepre'... % 'psc_o_prepost' 'q_o_prepost' 'lat_prepost' 'ris_prepost' 'decay_prepost' 'asynch_prepost' 'psc_o_postpre' 'q_o_postpre' 'lat_postpre' 'ris_postpre' 'decay_postpre'... % 'asynch_postpre' 'psc_o_postpost' 'q_o_postpost' 'lat_postpost' 'ris_postpost' 'decay_postpost' 'asynch_postpost'} % for twiki=1:length(control_variables) % eval(['control_variables{' num2str(twiki) '} = controll(' num2str(twiki) ',:)']) % end figure(5),set(5,'PaperOrientation','landscape','PaperPosition',[0.5 0.5 10 7.5]);hold on x_factors={ ['trials'] % % ['ITI_history'] % % ['temperature'] % % ['intensity_pre'] % % ['pulsedur_pre'] % ['r_access_chanone'] % ['r_input_chanone'] % ['leak_chanone'] % % ['intensity_post'] % % ['pulsedur_post'] ['r_access_chantwo'] ['r_input_chantwo'] ['leak_chantwo'] } x_cols=size(x_factors,1); y_factors={ % % 'psc_o_prepre' % % 'q_o_prepre' % % 'lat_prepre' % % 'ris_prepre' % % 'decay_prepre' % % 'asynch_prepre' 'psc_o_prepost' % 'q_o_prepost' % 'lat_prepost' % % 'ris_prepost' % % 'decay_prepost' % % 'asynch_prepost' % % 'psc_o_postpre' % % 'q_o_postpre' % % 'lat_postpre' % % 'ris_postpre' % % 'decay_postpre' % % 'asynch_postpre' % % 'psc_o_postpost' % % 'q_o_postpost' % % 'lat_postpost' % % 'ris_postpost' % % 'decay_postpost' % % 'asynch_postpost' % % 'tot_charge_chanone' % % 'leak_chanone' % % 'r_access_chanone' % % 'r_input_chanone' % % 'tot_charge_chantwo' % % 'leak_chantwo' % 'r_access_chantwo' % % 'r_input_chantwo' % % 'temperature' } %fixing 'trials' to count from the first trial to the last without restarting at one with each new file for epoch=1:length(epoch_dividers) if epochepoch,livetrials=[epoch_dividers(epoch)+.5 :epoch_dividers(epoch+1)-.5]; elseif length(epoch_dividers)==epoch,livetrials=[epoch_dividers(epoch)+.5:number_of_trials]; end end set(5,'PaperOrientation','landscape'); set(5,'PaperPosition',[0.5 0.5 10 7.5]); %------------------------- %an alternate plot that overlays things to be sure that changes in leak or resistance aren't confounding PSC measurements figure(6) markersize=19; font_size=22; %subplot(3,3,[1:6]) h1=subplot(4,4,[1:4]); plot(trials, psc_o_prepost,'o','markeredgecolor','k','markerfacecolor','k','markersize',markersize),legend('psc'),hold on ylabel('PSC','fontsize',font_size,'fontweight','bold','fontname','book antiqua') title(conjoined_filename,'fontsize',ceil(1.5*font_size),'fontweight','bold','fontname','book antiqua') %h1=gca; %set(h1,'yticklabel',[],'ytick',[],'Color','none','xticklabel',[],'ylim',[.5*min(psc_o_prepost) 1.5*max(psc_o_prepost)]) % h2=axes('position',get(h1,'position')); % plot(trials,leak_chanone,'o','markeredgecolor','r','markerfacecolor','r','markersize',markersize),legend('leak chanone'),hold on % set(h2,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[]) % h3=axes('position',get(h2,'position')); % plot(trials,r_access_chanone,'o','markeredgecolor','g','markerfacecolor','y','markersize',markersize),legend('r access chanone'),hold on % set(h3,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[]) % h4=axes('position',get(h3,'position')); % plot(trials,r_input_chanone,'o','markeredgecolor','b','markerfacecolor','b','markersize',markersize),legend('r input chanone'),hold on % set(h4,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[]) %h5=axes('position',get(h1,'position')); h5=subplot(4,4,[5:8]); plot(trials,leak_chantwo,'o','markeredgecolor','c','markerfacecolor','c','markersize',markersize),legend('leak chantwo'), hold on %set(h5,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[],'ylim',[.5*min(leak_chantwo) 1.5*max(leak_chantwo)]) ylabel('I_l_e_a_k','fontsize',font_size,'fontweight','bold','fontname','book antiqua') %h6=axes('position',get(h1,'position')); h6=subplot(4,4,[9:12]); plot(trials,r_access_chantwo,'o','markeredgecolor','m','markerfacecolor','m','markersize',markersize),legend('r access chantwo'), hold on %set(h6,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[],'ylim',[.5*min(r_access_chantwo) 1.5*max(r_access_chantwo)]) ylabel('R_a','fontsize',font_size,'fontweight','bold','fontname','book antiqua') %h7=axes('position',get(h1,'position')); h7=subplot(4,4,[13:16]); plot(trials,r_input_chantwo,'o','markeredgecolor','y','markerfacecolor','g','markersize',markersize),legend('r input chantwo'), hold on %set(h7,'yticklabel',[],'ytick',[],'Color','none','XTickLabel',[],'ylim',[.5*min(r_input_chantwo) 1.5*max(r_input_chantwo)]) ylabel('R_n','fontsize',font_size,'fontweight','bold','fontname','book antiqua') % %plot(corrected_postsyn_peak_times,sloop,'k-') %set(h2,'YAxisLocation','right','Color','none','XTickLabel',[]) for j=1:length(epoch_dividers) plot([epoch_dividers(j) epoch_dividers(j)],[min(r_input_chantwo) max(r_input_chantwo)],'r','LineWidth',3) end set(6,'PaperOrientation','landscape'); set(6,'PaperPosition',[0.5 0.5 10 7.5]);