-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathconstructExpRef.m
More file actions
28 lines (21 loc) · 974 Bytes
/
constructExpRef.m
File metadata and controls
28 lines (21 loc) · 974 Bytes
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 ref = constructExpRef(subjectRef, expDate, expSequence)
%DAT.CONSTRUCTEXPREF Constructs an experiment reference string
% ref = DAT.CONSTRUCTEXPREF(subject, date, seq) constructs and returns a
% standard format string reference, for the experiment using the 'subject',
% the 'date' of the experiment (a MATLAB datenum), and the daily sequence
% number of the experiment, 'seq' (must be an integer).
%
% Part of Rigbox
% 2013-03 CB created
% tabulate the args to get complete rows
[subjectRef, expDate, expSequence, singleArgs] = ...
tabulateArgs(subjectRef, expDate, expSequence);
% Convert the experiment datenums to strings
expDate = mapToCell(@(d) iff(ischar(d), d, @() datestr(d, 'yyyy-mm-dd')), expDate);
% Format the reference strings using elements from each property
ref = cellsprintf('%s_%i_%s', expDate, expSequence, subjectRef);
if singleArgs
% if non-cell inputs were supplied, make sure we don't return a cell
ref = ref{1};
end
end