function methods_numbers(fld) snrthres = 2.5; daythres = 3; monkeys = {'M1','M2'}; fprintf('\n======================================================\n'); fprintf(['-- Running methods_numbers with SNRth ' num2str(snrthres) ... ', DAYth ' num2str(daythres) ' --\n']); fprintf('======================================================\n'); for mi = 1:2 monkey = monkeys{mi}; %% find which data to include datainfo = session_info(); if strcmp(monkey,'M1') info = datainfo(1); else info = datainfo(2); end sessions = info.dates; MP = get_mp(fld,monkey,sessions); %% set SNR threshold and find channels and sessions % limit MP to snr threshold incl = MP.snr>snrthres; MP_ = MP; % copy for backup % only include channels that have at least 5 sessions MP = MP(incl,:); [chid, ch_list] = findgroups(MP.chan_id); session_per_chan = splitapply(@length,MP.session_id,chid); % make a list of channels that we will include chans = ch_list(session_per_chan>daythres); %% count goodtrials q = MP.goodtrials; thrownout = []; for ch = chans' thrownout(end+1) = round((1-sum(q{ch})/length(q{ch}))*10000)/100; end disp(['for ' monkey ', we threw out between ' num2str(min(thrownout)) '% and ' num2str(max(thrownout)) '% of the trials']); end