function [pWelch_preRUN, pWelch_stimRUN] = andor_INC_step4_periodo_allstimfreq(stimfreq,ctrl) LT = load(['INC' ctrl 'base_linearTrack_' stimfreq],'fWelch','pWelch_pre','pWelch_stim','pWelch_post','rowdata','runindex','thetaindex'); indexArena = repmat({'linearTrack'},size(LT.fWelch,1),1); indexLT = and(LT.runindex,LT.thetaindex); pWelch_preLT = LT.pWelch_pre(indexLT,:); pWelch_stimLT = LT.pWelch_stim(indexLT,:); pWelch_postLT = LT.pWelch_post(indexLT,:); rowdataLT = LT.rowdata(indexLT,:); indexArenaLT = indexArena(indexLT,:); if ~strcmp(stimfreq,'f10Hz') HB = load(['INC' ctrl 'base_holeBox_' stimfreq],'fWelch','pWelch_pre','pWelch_stim','pWelch_post','rowdata','runindex','thetaindex'); indexArena = repmat({'holeBox'},size(HB.fWelch,1),1); indexHB = and(HB.runindex,HB.thetaindex); pWelch_preHB = HB.pWelch_pre(indexHB,:); pWelch_stimHB = HB.pWelch_stim(indexHB,:); pWelch_postHB = HB.pWelch_post(indexHB,:); rowdataHB = HB.rowdata(indexHB,:); indexArenaHB = indexArena(indexHB,:); indexArenaRUN = [indexArenaLT; indexArenaHB]; rowdataRUN = [rowdataLT; rowdataHB]; pWelch_preRUN = [pWelch_preLT; pWelch_preHB]; pWelch_stimRUN = [pWelch_stimLT; pWelch_stimHB]; pWelch_postRUN = [pWelch_postLT; pWelch_postHB]; else pWelch_preRUN = pWelch_preLT; pWelch_stimRUN = pWelch_stimLT; end