1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- function modify_mp(fld,monkey,sessions)
- datadir = fld.procdatadir;
- logdir = fullfile(fld.basedir,'Datasets', monkey ,'log');
- fprintf('\n======================================================\n');
- fprintf(['-- Running modify_mp for ' monkey ' --\n']);
- fprintf('======================================================\n');
- MP = [];
- for sid = 1:length(sessions)
- % session info
- session = sessions{sid};
- q = strsplit(session,'_');
- cdate = q{2};
- block = str2num(q{3}(end-4));
- % load the data
- session_id = [monkey '_' cdate '_' num2str(block)];
- sessiondir = fullfile(datadir,monkey,session_id);
- try
- load(fullfile(sessiondir, [session_id '_channels.mat']));
- catch
- continue
- end
-
- new_gt = cell(0);
- new_sgt = cell(0);
- for ch = 1:size(mp,1)
- gt = mp.goodtrials(ch,:);
-
- % we shouldn't do this multiple times
- if iscell(gt)
- while size(gt,1)==1 && size(gt,2)==1
- gt = gt{1};
- end
- new_gt{ch} = gt;
- else
- new_gt{ch} = mp.goodtrials(ch,:);
- end
-
- sgt = mp.sample_wise_goodtrials(ch,:);
- if iscell(sgt)
- while size(sgt,1)==1 && size(sgt,2)==1
- sgt = sgt{1};
- end
- new_sgt{ch} = sgt;
- else
- new_sgt{ch} = mp.sample_wise_goodtrials(ch,:);
- end
- end
- mp.goodtrials = new_gt';
- mp.sample_wise_goodtrials = new_sgt';
-
- save(fullfile(sessiondir, [session_id '_channels.mat']),'mp');
- end
|