forked from CodyScholtens/KilosortPLX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplx_ad_resolve_channel.m
36 lines (32 loc) · 1.11 KB
/
plx_ad_resolve_channel.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
28
29
30
31
32
33
34
35
36
function [channelNumber] = plx_ad_resolve_chennel(filename, channel)
% plx_ad_resolve_chennel(filename, channel): returns .plx file raw a/d channel number for the specified channel name
%
% [channelNumber] = plx_ad_resolve_chennel(filename, channel)
%
% INPUT:
% filename - .plx file name
% channel - 0-based channel number or channel name
%
% OUTPUT:
% channelNumber - 0-based channel number.
% if channel is a char array (channel name), returns channel number for the specified channel name.
% if channel with the specified name is not found, returns -1
% if channel is a number, returns this number
channelNumber = -1;
if nargin ~= 2
error 'expected 2 input arguments';
end
channelNumber = -1;
if ischar(channel) == 1
[numNames, names] = plx_adchan_names(filename);
[numMapped, adchans] = plx_ad_chanmap(filename);
for i=1:numNames
if strcmp(deblank(names(i,:)), deblank(channel)) == 1
channelNumber = adchans(i);
break
end
end
else
channelNumber = channel;
end
end