function stsd_grid_plotter_raw2(plain_rawmatrix,azaz_record,permutations_of_IPIs,APs_in_the_train,max_length_raw,number_of_trials,conjoined_filename,NLize_raw,postsynaptic_side,hy,...
        age_and_types,raw_axis,min_length_raw,meanmode_raw,raw_include_SD,indivmode_raw,raw_movie_format,raw_comparison_format,epoch_dividers,parameter_colors,...
        synapse_in_question,samples_per_ms,epochal_colormaps,fit_array,analyze_fitted_curves)

width_=1/(length(permutations_of_IPIs)+1);
target_depth=length(permutations_of_IPIs)
current_path=zeros(1,target_depth)
while target_depth>0
    while length(current_path)==target_depth
        current_path=pathfinder(current_path,permutations_of_IPIs,target_depth)
        %-------------plotting
        plot_raw_grid(current_path,permutations_of_IPIs,azaz_record,epoch_dividers,number_of_trials,indivmode_raw,width_,APs_in_the_train,plain_rawmatrix,...
            parameter_colors,conjoined_filename,synapse_in_question,age_and_types,raw_axis,hy,samples_per_ms,raw_include_SD,epochal_colormaps,fit_array,analyze_fitted_curves)
        %-------------
        if isequal(current_path,permutations_of_IPIs(1:target_depth))%that is, if this is the final current_path at this length
            current_path=zeros(1,target_depth-1);%to break the inner while loop and prepare for the next target_depth
        end
    end    
    target_depth=target_depth-1;
end
%plotting the responses to the first AP, for which all trials are a match
current_path=[]
plot_raw_grid(current_path,permutations_of_IPIs,azaz_record,epoch_dividers,number_of_trials,indivmode_raw,width_,APs_in_the_train,plain_rawmatrix,...
            parameter_colors,conjoined_filename,synapse_in_question,age_and_types,raw_axis,hy,samples_per_ms,raw_include_SD,epochal_colormaps,fit_array,analyze_fitted_curves)
%------------------------
% figure(23)
% set(23,'Position',[1          30        1600        1101])
% %colordef(figure(23),'black')
% set(23, 'color', 'k');
% hold on
% general_PSC_vector=prod(permutations_of_IPIs)*possible_repetitions_of_permutation*APs_in_the_train*[0:max_length_raw-1];
% AP_indexing_increment=prod(permutations_of_IPIs)*possible_repetitions_of_permutation;
% width_=1/(length(permutations_of_IPIs)+1);
% subplot('position',[0 7/8 width_ 1/8])
% axis([0 1 0 1])
% text(0.2,0.5,conjoined_filename,'FontWeight','bold','FontSize',24)
% recording_side={'pre' 'post'};
% text(0.2,0,strcat('recording side:',recording_side{postsynaptic_side}))
% text(0.2,-.5,'membrane current')
% axis off
% subplot('position',[0 1/8 width_ 1/8])
% axis([0 1 0 1])
% text(0.2,0.2,num2str(hy))
% text(0.2,-.2,age_and_types)
% axis off
% set(findobj(gcf,'Type','text'),'Color','w')
% colorscale=0;
% if colorscale
% 	subplot('position',[width_/5 0.02 width_/2 1/30])
% 	imagesc([1:analyzable_trials_preinduction],[1 analyzable_trials_preinduction])
% 	title('color by trial')
% 	set(gca,'ytick',[])
% end
% if NLize_raw,raw_axis=[0 500 0 1];end
% 
% if meanmode_raw
%     target_depth=length(permutations_of_IPIs);
% % 	while target_depth  %the topmost loop corresponds to the number of layers, that is, the length of permutations_of_IPIs -- it runs the runthroughs of the whole thing
% %         %every time it finishes the for loop at the topmost layer, the place holder telling how many layers deep to go decrements and it starts the topmost for loop over again
% %         current_depth=1;
% %         current_path=zeros(1,target_depth);
% %         floor_of_plot=0;
% %         current_depth=leafmapper(current_depth,target_depth,current_path,permutations_of_IPIs,width_,azaz_record,indexx_record,possible_repetitions_of_permutation,stsd_parameters,...
% %         parameter_colors,stsd_extracted_matrix,epoch_dividers,number_of_trials,APs_in_the_train); 
% %         target_depth=target_depth-1;
% % 	end
% 	
% 	%handling the response after the *first* pulse (for which history all trials are a 'match')
% 	figure(23)
% 	subplot('position',[.1 .25 width_-.1 .5])
% 	matches=[1:number_of_trials];
% 	
% % 	for axx=1:length(stsd_parameters)%making a different axis for each parameter, reused as that parameter is revisited each epoch
% %         axishandles{axx}=axes('position',get(gca,'position'));
% % 	end
% 	
% 	if ~isempty(epoch_dividers),trials_that_were_during_this_epoch=[1:epoch_dividers(1)-.5];else trials_that_were_during_this_epoch=1:number_of_trials;end
% 	for epoch=1:length(epoch_dividers)+1
%         %for parameter=1:length(stsd_parameters)
%             matches_this_epoch=matches(find(matches>trials_that_were_during_this_epoch(1)-.5&matches<trials_that_were_during_this_epoch(end)+.5));
%             if isempty(matches_this_epoch),error('epoch problem'),end 
%             %stsd_raw_matrix(trial_reindex+((0:max_length_raw-1)*prod(permutations_of_IPIs)*possible_repetitions_of_permutation*APs_in_the_train))
%             hot_spots=indexx_record(matches_this_epoch)+((0:max_length_raw-1)*prod(permutations_of_IPIs)*possible_repetitions_of_permutation*APs_in_the_train);
%             points_of_light=stsd_raw_matrix([hot_spots]);
% %             if ~isempty(points_of_light)
% %                 if ylimz{parameter}(1)==0&ylimz{parameter}(2)==0,ylimz{parameter}(1)=min(points_of_light);ylimz{parameter}(2)=.9*max(points_of_light);
% %                    if ylimz{parameter}(1)>ylimz{parameter}(2),ylimz{parameter}=fliplr(ylimz{parameter});end 
% %                 end
% %                 if min(points_of_light)<ylimz{parameter}(1),ylimz{parameter}(1)=min(points_of_light);elseif max(points_of_light)>ylimz{parameter}(2),ylimz{parameter}(2)=max(points_of_light);end
% %             end
% %             %if find(isnan(points_of_light)),error('sch'),end
% %             axes(axishandles{parameter})
% %             plot(parameter+(length(stsd_parameters)*(epoch-1)),mean(points_of_light),'s','markerfacecolor',parameter_colors{parameter},'markeredgecolor',parameter_colors{parameter},...
% %                 'markersize',10),hold on
% %             plot([parameter+(length(stsd_parameters)*(epoch-1)) parameter+(length(stsd_parameters)*(epoch-1))],[mean(points_of_light)-std(points_of_light) mean(points_of_light)+...
% %                     std(points_of_light)],'k','LineWidth',2),hold on
% %             set(gca,'color','none','ytick',[],'yticklabel',[],'ylim',ylimz{parameter},'xtick',[],'xticklabel',[],'xlim',[0 (length(epoch_dividers)+1)*length(stsd_parameters)+1])
% %          end
% 	%    ylim(ylimz{parameter})
%         if length(epoch_dividers)>epoch,trials_that_were_during_this_epoch=[epoch_dividers(epoch)+.5 :epoch_dividers(epoch+1)-.5];
%         elseif length(epoch_dividers)==epoch,trials_that_were_during_this_epoch=[epoch_dividers(epoch)+.5:number_of_trials];
%         end
% 	end
% 	
% 	for j=1:length(epoch_dividers)
%         plot([(j*length(stsd_parameters))+.5 (j*length(stsd_parameters))+.5],[-100000 100000],'color',[.7 .7 .7],'LineWidth',5)
% 	end
% 	title(strcat(conjoined_filename,'__',synapse_in_question,'__',age_and_types),'fontweight','bold')
% 	set(50,'PaperOrientation','landscape');
% 	set(50,'PaperPosition',[0.5 0.5 10 7.5]);
% 
% 
%     
%     
%     
% elseif indivmode_raw
%     if raw_comparison_format
%         if ~isempty(epoch_dividers),livetrials=[1:epoch_dividers(1)-.5];else livetrials=1:number_of_trials;end
%         for epoch=1:length(epoch_dividers)+1
%             aa=livetrials
%             bb=indexx_record
%             for myxlplyx=1:livetrials
%                 disp('hi')
%                 ind=indexx_record(myxlplyx);
%                 ind=ind+general_PSC_vector;
%                 subplot('position',[.2*width_ 1/4 .8*width_ 1/2])
%                 raw_o=stsd_raw_matrix(ind);
%                 if NLize_raw, raw_o=raw_o/(min(raw_o)); end
%                 plot(raw_o,'color',parameter_colors{epoch}),hold on,set(gca,'color','k'),axis(raw_axis)%set(gca,'axis',[raw_axis])
%                 aza=azaz_record(myxlplyx,:);
%                 floor_of_plot=0;
%                 for eyepeeeye=1:length(permutations_of_IPIs)
%                     aaa=eyepeeeye
%                     for IPI=1:permutations_of_IPIs(eyepeeeye)
%                         bee=IPI
%                         cee=aza
%                         dee=permutations_of_IPIs
%                         if IPI==aza(eyepeeeye)
%                             floor_of_plot=floor_of_plot+((permutations_of_IPIs(eyepeeeye)-IPI)/prod(permutations_of_IPIs(1:eyepeeeye)));
%                             subplot('position',[eyepeeeye*width_ floor_of_plot width_ 1/prod(permutations_of_IPIs(1:eyepeeeye))])
%                             raw_x=stsd_raw_matrix(ind+(eyepeeeye*AP_indexing_increment));
%                             if NLize_raw, raw_x=raw_x/(min(raw_o)); end
%                             plot(raw_x,'color',parameter_colors{epoch}),hold on,set(gca,'color','k')%,axis(raw_axis)%set(gca,'axis',[raw_axis])
%                             break    
%                         end
%                     end
%                 end
%             end
%             if length(epoch_dividers)>epoch,livetrials=[epoch_dividers(epoch)+.5 :epoch_dividers(epoch+1)-.5];end
%         end
%     elseif raw_movie_format
%         clrmp=colormap(jet(number_of_trials)); frame_number=1;
%         for myxlplyx=1:number_of_trials
%             ind=ind_record(myxlyplyx)
%             ind=ind+general_PSC_vector
%             subplot('position',[.2*width_ 1/4 .8*width_ 1/2])
%             raw_o=stsd_raw_matrix(ind);
%             if NLize_raw, min_raw_o=min(raw_o);raw_o=raw_o/min_raw_o; end
%             new=plot(raw_o,'color','w','LineWidth',2),hold on,set(gca,'color','k'),set(gca,'axis',[raw_axis])
%             M(frame_number)=getframe(23,[51 50 1500 1051]);frame_number=frame_number+1;
%             delete(new)
%             olde=plot(raw_o,'Color',clrmp(myxlplyx,:)),hold on,set(gca,'color','k'),set(gca,'axis',[raw_axis])
%             M(frame_number)=getframe(23,[51 50 1500 1051]);frame_number=frame_number+1;
%             aza=azaz_record(myxlplyx,:);
%             floor_of_plot=0;
%             for eyepeeeye=1:length(permutations_of_IPIs)
%                 for IPI=1:permutations_of_IPIs(eeyepeeeye)
%                     if IPI==aza(eyepeeeye)
%                         floor_of_plot=floor_of_plot+((permutations_of_IPIs(eyepeeeye)-IPI)/prod(permutations_of_IPIs(1:eyepeeeye)));
%                         subplot('position',[eyepeeeye*width_ floor_of_plot width_ 1/prod(permutations_of_IPIs(1:eyepeeeye))])
%                         raw_x=stsd_raw_matrix(ind+(eyepeeeye*AP_indexing_increment));
%                         if NLize_raw, raw_x=raw_x/min_raw_o; end
%                         new=plot(raw_x,'color','w','LineWidth',2),hold on,set(gca,'color','k'),set(gca,'axis',[raw_axis])
%                         M(frame_number)=getframe(23,[51 50 1500 1051]);frame_number=frame_number+1;
%                         delete(new)
%                         olde=plot(raw_x,'Color',clrmp(myxlplyx,:)),hold on,set(gca,'color','k'),set(gca,'axis',[raw_axis])
%                         M(frame_number)=getframe(23,[51 50 1500 1051]);frame_number=frame_number+1;
%                         break
%                     end
%                 end
%             end
%         end
%     end
% end
%                 
% 
% % all_subplots=get(23,'children') %this solution won't work so well for movies, but otherwise could be good
% % for mm=1:length(all_subplots)
% %     if findobj(all_subplots(mm),'Type','line'),set(all_subplots(mm),'ylim',[-500 0]), end
% % end
% 
% set(23,'PaperOrientation','landscape');
% set(23,'PaperPosition',[0.5 0.5 10 7.5]);
% if raw_movie_format
% 	short_name=strrep(conjoined_filename,'.hdf','');
% 	filename=strcat(short_name,'__movie');
% 	pathname=strcat('C:\Documents and Settings\david nauen\Desktop\extracted_values\',filename);
% 	var='M';
% 	save(pathname,var)
% 	% close(23)
% 	% pause(5)
% 	% clear M
% 	% load(pathname)
% 	% bubu=M
% 	% figure(23)
% 	% set(23,'position',[1 30 1600 1101])
% 	% axis off
% 	% movie(bubu)
% 	%movie2avi(M,'junkmovieavi2.avi','FPS',2,'compression','none','quality',50);
% end