Skip to content

Commit 25074f5

Browse files
committed
check for valid units in pspm_pupil_pp
1 parent 83eea93 commit 25074f5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pspm_pupil_pp.m

+10
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@
153153
[sts_load, data,infos, pos_of_channel(1)] = pspm_load_channel(alldata, options.channel, 'pupil');
154154
if sts_load ~= 1, return, end
155155

156+
% Check for invalid pupil data units
157+
allowed_units = {'mm', 'cm', 'dm', 'm', 'km', 'in', 'inches'};
158+
if ~ismember(data.header.units, allowed_units)
159+
warning('pspm_pupil_pp:InvalidUnit', ...
160+
'Unsupported pupil data unit: %s. Allowed units are: %s', ...
161+
data.header.units, strjoin(allowed_units, ', '));
162+
return
163+
end
164+
165+
156166
if action_combine
157167
[sts_load, data_combine, infos, pos_of_channel(2)] = pspm_load_channel(alldata, options.channel_combine, 'pupil');
158168
if sts_load ~= 1

0 commit comments

Comments
 (0)