📄 loadcnt.m
字号:
% loadcnt() - Load a Neuroscan continuous signal file.%% Usage:% >> cnt = loadcnt(file, varargin) %% Inputs:% filename - name of the file with extension%% Optional inputs:% 't1' - start at time t1, default 0% 'sample1' - start at sample1, default 0, overrides t1% 'lddur' - duration of segment to load, default = whole file% 'ldnsamples' - number of samples to load, default = whole file, % overrides lddur% 'scale' - ['on'|'off'] scale data to microvolt (default:'on')% 'dataformat' - ['int16'|'int32'] default is 'int16' for 16-bit data.% Use 'int32' for 32-bit data.% 'blockread' - [integer] by default it is automatically determined % from the file header, though sometimes it finds an % incorect value, so you may want to enter a value manually % here (1 is the most standard value).%% Outputs:% cnt - structure with the continuous data and other informations% cnt.header% cnt.electloc% cnt.data% cnt.tag%% Authors: Sean Fitzgibbon, Arnaud Delorme, 2000-%% Note: function original name was load_scan41.m%% Known limitations: % For more see http://www.cnl.salk.edu/~arno/cntload/index.html %123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 2000 Sean Fitzgibbon, <psspf@id.psy.flinders.edu.au>% Copyright (C) 2003 Arnaud Delorme, Salk Institute, arno@salk.edu%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA% $Log: loadcnt.m,v $% Revision 1.16 2004/03/19 18:52:42 arno% blockread msg%% Revision 1.15 2004/03/19 18:51:26 arno% allowing blockread option%% Revision 1.14 2003/11/05 16:38:08 arno% reading events for 32-bit data%% Revision 1.13 2003/10/30 19:41:01 arno% updating error message%% Revision 1.12 2003/10/30 19:23:54 arno% adding revision line%function [f,lab,ev2p] = loadcnt(filename,varargin)if ~isempty(varargin) r=struct(varargin{:});else r = []; end;try, r.t1; catch, r.t1=0; endtry, r.sample1; catch, r.sample1=[]; endtry, r.lddur; catch, r.lddur=[]; endtry, r.ldnsamples; catch, r.ldnsamples=[]; endtry, r.scale; catch, r.scale='on'; endtry, r.blockread; catch, r.blockread = []; endsizeEvent1 = 8 ; %%% 8 bytes for Event1 sizeEvent2 = 19 ; %%% 19 bytes for Event2 type='cnt';if nargin ==1 scan=0;end fid = fopen(filename,'r');disp(['Loading file ' filename ' ...'])h.rev = fread(fid,12,'char');h.nextfile = fread(fid,1,'long');h.prevfile = fread(fid,1,'long');h.type = fread(fid,1,'char');h.id = fread(fid,20,'char');h.oper = fread(fid,20,'char');h.doctor = fread(fid,20,'char');h.referral = fread(fid,20,'char');h.hospital = fread(fid,20,'char');h.patient = fread(fid,20,'char');h.age = fread(fid,1,'short');h.sex = fread(fid,1,'char');h.hand = fread(fid,1,'char');h.med = fread(fid,20, 'char');h.category = fread(fid,20, 'char');h.state = fread(fid,20, 'char');h.label = fread(fid,20, 'char');h.date = fread(fid,10, 'char');h.time = fread(fid,12, 'char');h.mean_age = fread(fid,1,'float');h.stdev = fread(fid,1,'float');h.n = fread(fid,1,'short');h.compfile = fread(fid,38,'char');h.spectwincomp = fread(fid,1,'float');h.meanaccuracy = fread(fid,1,'float');h.meanlatency = fread(fid,1,'float');h.sortfile = fread(fid,46,'char');h.numevents = fread(fid,1,'int');h.compoper = fread(fid,1,'char');h.avgmode = fread(fid,1,'char');h.review = fread(fid,1,'char');h.nsweeps = fread(fid,1,'ushort');h.compsweeps = fread(fid,1,'ushort');h.acceptcnt = fread(fid,1,'ushort');h.rejectcnt = fread(fid,1,'ushort');h.pnts = fread(fid,1,'ushort');h.nchannels = fread(fid,1,'ushort');h.avgupdate = fread(fid,1,'ushort');h.domain = fread(fid,1,'char');h.variance = fread(fid,1,'char');h.rate = fread(fid,1,'ushort');h.scale = fread(fid,1,'double');h.veogcorrect = fread(fid,1,'char');h.heogcorrect = fread(fid,1,'char');h.aux1correct = fread(fid,1,'char');h.aux2correct = fread(fid,1,'char');h.veogtrig = fread(fid,1,'float');h.heogtrig = fread(fid,1,'float');h.aux1trig = fread(fid,1,'float');h.aux2trig = fread(fid,1,'float');h.heogchnl = fread(fid,1,'short');h.veogchnl = fread(fid,1,'short');h.aux1chnl = fread(fid,1,'short');h.aux2chnl = fread(fid,1,'short');h.veogdir = fread(fid,1,'char');h.heogdir = fread(fid,1,'char');h.aux1dir = fread(fid,1,'char');h.aux2dir = fread(fid,1,'char');h.veog_n = fread(fid,1,'short');h.heog_n = fread(fid,1,'short');h.aux1_n = fread(fid,1,'short');h.aux2_n = fread(fid,1,'short');h.veogmaxcnt = fread(fid,1,'short');h.heogmaxcnt = fread(fid,1,'short');h.aux1maxcnt = fread(fid,1,'short');h.aux2maxcnt = fread(fid,1,'short');h.veogmethod = fread(fid,1,'char');h.heogmethod = fread(fid,1,'char');h.aux1method = fread(fid,1,'char');h.aux2method = fread(fid,1,'char');h.ampsensitivity = fread(fid,1,'float');h.lowpass = fread(fid,1,'char');h.highpass = fread(fid,1,'char');h.notch = fread(fid,1,'char');h.autoclipadd = fread(fid,1,'char');h.baseline = fread(fid,1,'char');h.offstart = fread(fid,1,'float');h.offstop = fread(fid,1,'float');h.reject = fread(fid,1,'char');h.rejstart = fread(fid,1,'float');h.rejstop = fread(fid,1,'float');h.rejmin = fread(fid,1,'float');h.rejmax = fread(fid,1,'float');h.trigtype = fread(fid,1,'char');h.trigval = fread(fid,1,'float');h.trigchnl = fread(fid,1,'char');h.trigmask = fread(fid,1,'short');h.trigisi = fread(fid,1,'float');h.trigmin = fread(fid,1,'float');h.trigmax = fread(fid,1,'float');h.trigdir = fread(fid,1,'char');h.autoscale = fread(fid,1,'char');h.n2 = fread(fid,1,'short');h.dir = fread(fid,1,'char');h.dispmin = fread(fid,1,'float');h.dispmax = fread(fid,1,'float');h.xmin = fread(fid,1,'float');h.xmax = fread(fid,1,'float');h.automin = fread(fid,1,'float');h.automax = fread(fid,1,'float');h.zmin = fread(fid,1,'float');h.zmax = fread(fid,1,'float');h.lowcut = fread(fid,1,'float');h.highcut = fread(fid,1,'float');h.common = fread(fid,1,'char');h.savemode = fread(fid,1,'char');h.manmode = fread(fid,1,'char');h.ref = fread(fid,10,'char');h.rectify = fread(fid,1,'char');h.displayxmin = fread(fid,1,'float');h.displayxmax = fread(fid,1,'float');h.phase = fread(fid,1,'char');h.screen = fread(fid,16,'char');h.calmode = fread(fid,1,'short');h.calmethod = fread(fid,1,'short');h.calupdate = fread(fid,1,'short');h.calbaseline = fread(fid,1,'short');h.calsweeps = fread(fid,1,'short');h.calattenuator = fread(fid,1,'float');h.calpulsevolt = fread(fid,1,'float');h.calpulsestart = fread(fid,1,'float');h.calpulsestop = fread(fid,1,'float');h.calfreq = fread(fid,1,'float');h.taskfile = fread(fid,34,'char');h.seqfile = fread(fid,34,'char');h.spectmethod = fread(fid,1,'char');h.spectscaling = fread(fid,1,'char');h.spectwindow = fread(fid,1,'char');h.spectwinlength = fread(fid,1,'float');h.spectorder = fread(fid,1,'char');h.notchfilter = fread(fid,1,'char');h.headgain = fread(fid,1,'short');h.additionalfiles = fread(fid,1,'int');h.unused = fread(fid,5,'char');h.fspstopmethod = fread(fid,1,'short');h.fspstopmode = fread(fid,1,'short');h.fspfvalue = fread(fid,1,'float');h.fsppoint = fread(fid,1,'short');h.fspblocksize = fread(fid,1,'short');h.fspp1 = fread(fid,1,'ushort');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -