-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplx_ad_chanmap.m
37 lines (35 loc) · 1.46 KB
/
plx_ad_chanmap.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
37
function [n,adchans] = plx_ad_chanmap(filename)
% plx_ad_chanmap(filename) -- return map of raw continuous channel numbers for each channel
%
% [n,adchans] = plx_ad_chanmap(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% n - number of continuous channels
% adchans - 1 x n array of continuous channel numbers
%
% Normally, there is one channel entry in the .plx for for each raw continuous channel,
% so the mapping is trivial adchans[i] = i-1 (because continuous channels start at 0).
% However, for certain .plx files saved in some ways from OFS (notably after
% loading data files from other vendors), the mapping can be more complex.
% E.g. there may be only 2 non-empty channels in a .plx file, but those channels
% correspond to raw channel numbers 7 and 34. So in this case NChans = 2,
% and adchans[1] = 7, adchans[2] = 34.
% The plx_ routines that return arrays always return arrays of size NChans. However,
% routines that take channels numbers as arguments always expect the raw
% channel number. So in the above example, to get the data from
% the second channel, use
% [adfreq, n, ts, fn, ad] = plx_ad(filename, adchans[2])
if nargin < 1
error 'Expected 1 input argument';
end
if (isempty(filename))
[fname, pathname] = uigetfile('*.plx', 'Select a Plexon .plx file');
if isequal(fname,0)
error 'No file was selected'
end
filename = fullfile(pathname, fname);
end
[n,adchans] = mexPlex(27,filename);