-
Notifications
You must be signed in to change notification settings - Fork 4
/
getExperimentID.m
27 lines (21 loc) · 1.06 KB
/
getExperimentID.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function [expID,recordingSegment] = getExperimentID(TimeSeries)
% Returns a set of experiment IDs from a set of time series
% Also the recordingSegment (the 12 hour block taken from that experiment)
%-------------------------------------------------------------------------------
% First we want the names:
fileNames = TimeSeries.Name;
% New method: split on the dot:
splitDot = regexp(fileNames,'\.','split');
splitDot_ID = cellfun(@(x)x{1},splitDot,'UniformOutput',false);
[uniqueIDs,~,expID] = unique(splitDot_ID);
% Then we want to split on underscore:
splitUnderscore = regexp(fileNames,'_','split');
% Experiment IDs as the first three numbers of third component?:
% splitUnderscore_ID = cellfun(@(x)x{3},splitUnderscore,'UniformOutput',0);
% expID = cellfun(@(x)str2num(x(1:3)),splitUnderscore_ID,'UniformOutput',1);
% recordingSegment as the numbers of final component?:
if nargout > 1
splitUnderscore_segment = cellfun(@(x)x{5},splitUnderscore,'UniformOutput',false);
recordingSegment = cellfun(@(x)str2num(x),splitUnderscore_segment,'UniformOutput',true);
end
end