1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- function [MP, MP_old] = get_mp(fld,monkey, sessions)
- % this function concatenates the mp table that was created for individual
- % sessions. it has 1 row per channel, so the resulting MP table will have 1
- % row per channel per session. this function also removes rows that never
- % have a stimulus in their RF. the original (with all rows intact) is
- % returned as MP_old.
- datadir = fld.procdatadir;
- 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
- %load([sessiondir session_id '_LUT.mat']);
-
- % add some session data
- session_id = repmat(sid,size(mp,1),1);
- date = repmat({cdate},size(mp,1),1);
- block = repmat(block,size(mp,1),1);
-
- mp = addvars(mp,session_id,date,block,'After','monkey_id');
-
- % concatenate
- MP = [MP; mp];
- end
- %% count rows that have empty values for Tar
- % in constructing MP, we added all channels that were available. each
- % channel is given a value for RFPos, which is available in MP.rfpos. this
- % value is technically between 1 and 6 and denotes the stimulus positions
- % that falls in the RF, but in practice, it's only ever 1 or empty.
- % this means that channels with RFPos=1 have a stimulus in their RF. we can
- % exclude channels that have an empty RFPos.
- emptyrows = cellfun('isempty',MP.Tar);
- disp(['There are ' num2str(sum(emptyrows)) ' empty rows']);
- MP_old = MP;
- MP(emptyrows,:) = [];
- disp(['There are ' num2str(length(unique(MP.chan_id))) ' usable channels for this monkey']);
|