Last active
June 12, 2019 11:21
-
-
Save kouichi-c-nakamura/cf75731187caa99f888e71a0292e76b6 to your computer and use it in GitHub Desktop.
CEDS64ChanList MATLAB function returns a table of channels in the Spike2 data file specified by a handle fhand.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function T = CEDS64ChanList(fhand) | |
% CEDS64ChanList returns a table of channels in the Spike2 data file | |
% specified by a handle fhand. | |
% | |
% SYNTAX | |
% T = CEDS64ChanList(fhand) | |
% | |
% | |
% INPUT ARGUMENTS | |
% fhand integer | |
% Handle for a file. Use fhand = CEDS64Open(filename) to obtain fhand. | |
% | |
% | |
% OUTPUT ARGUMENTS | |
% T table | |
% A table containing the following variables: | |
% | |
% 'ChanNumber' .... double, channel number | |
% 'ChanTypeN' .... double, channel type as an integer | |
% 'ChanType' .... string, channel type | |
% 'ChanTitle' .... string, channel title | |
% 'ChanComment' .... string, channel comment | |
% | |
% Written by Kouichi C. Nakamura Ph.D. | |
% MRC Brain Network Dynamics Unit | |
% University of Oxford | |
% kouichi.c.nakamura@gmail.com | |
% 12-Jun-2019 12:05:26 | |
% | |
% See also | |
% CEDS64MaxChan, CEDS64ChanType, CEDS64ChanTitle, CEDS64ChanComment | |
% SONChanList (SigTOOL) | |
iMaxChan = CEDS64MaxChan(fhand); | |
tf = false(iMaxChan,1); | |
channumbers = NaN(iMaxChan,1); | |
chantypenumbers = NaN(iMaxChan,1); | |
chantypes = strings(iMaxChan,1); | |
chantitles = strings(iMaxChan,1); | |
chancomments = strings(iMaxChan,1); | |
for i = 1:iMaxChan | |
if CEDS64ChanType(fhand,i) ~= 0 | |
tf(i) = true; | |
channumbers(i) = i; | |
chantypenumbers(i) = CEDS64ChanType(fhand,i); | |
[~,chantitles{i}] = CEDS64ChanTitle(fhand,i); | |
[~,chancomments{i}] = CEDS64ChanComment(fhand,i); | |
% iType - 0 no channel | |
% 1 Waveform channel | |
% 2 Event (falling) | |
% 3 Event (rising) | |
% 4 Event (both) | |
% 5 Marker | |
% 6 Wavemark | |
% 7 Realmark | |
% 8 TextMark | |
% 9 Realwave | |
% or a negative error code | |
switch chantypenumbers(i) | |
case 0 | |
chantypes{i} = 'no channel'; | |
case 1 | |
chantypes{i} = 'Waveform'; | |
case 2 | |
chantypes{i} = 'Event (falling)'; | |
case 3 | |
chantypes{i} = 'Event (rising)'; | |
case 4 | |
chantypes{i} = 'Event (both)'; | |
case 5 | |
chantypes{i} = 'Marker'; | |
case 6 | |
chantypes{i} = 'Wavemark'; | |
case 7 | |
chantypes{i} = 'Realmark'; | |
case 8 | |
chantypes{i} = 'TextMark'; | |
case 9 | |
chantypes{i} = 'Realwave'; | |
otherwise | |
chantypes{i} = 'error'; | |
end | |
end | |
end | |
T = table(tf,channumbers,chantypenumbers,chantypes,chantitles,chancomments,... | |
'VariableNames',{'TF','ChanNumber','ChanTypeN','ChanType','ChanTitle','ChanComment'}); | |
T(~T.TF,:) = []; | |
T.TF = []; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to know the channels in a file? (CED Spike2 forum)
http://www.ced.co.uk/phpBB3/viewtopic.php?f=5&t=2037&p=10405#p10405