⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo3.m

📁 matlab数字信号处理工具箱
💻 M
字号:
% Demostration for generating EDF/BDF/GDF-files
% DEMO3 is part of the biosig-toolbox
%    and it tests also Matlab/Octave for its correctness. 
% 
%  computer	version 		test
%            MATLAB
%   PCWIN	5.3.0.10183 (R11)	OK
%   PCWIN	6.5.0.180913a (R13)	OK
%   LNX86	5.3.0.10183 (R11)	OK
%   LNX86	6.5.0.180913a (R13)	OK
% 	     OCTAVE
%   i686-pc-cygwin	2.1.42		OK
%   i586-pc-linux-gnu   2.1.40		OK

%	$Revision: 1.5 $
%	$Id: demo3.m,v 1.5 2004/04/15 17:28:59 schloegl Exp $
%	Copyright (C) 2000-2003 by Alois Schloegl <a.schloegl@ieee.org>	

% This library is free software; you can redistribute it and/or
% modify it under the terms of the GNU Library General Public
% License as published by the Free Software Foundation; either
% Version 2 of the License, or (at your option) any later version.
%
% This library 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
% Library General Public License for more details.
%
% You should have received a copy of the GNU Library General Public
% License along with this library; if not, write to the
% Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA  02111-1307, USA.

x = randn(10000,5)+(1:1e4)'*ones(1,5); % test data
x = (1:1e4)'*ones(1,5); % test data
clear HDR;

VER   = version;
cname = computer;

% select file format 
HDR.TYPE='GDF';
%HDR.TYPE='EDF';
%HDR.TYPE='BDF'; 

% set Filename
HDR.FileName = ['TEST_',VER([1,3]),cname(1:3),'.',HDR.TYPE];

% person identification, max 80 char
HDR.PID = 'person identification';	% e.g. 'MCH-0234567 F 02-MAY-1951 Haagse_Harry'

% recording identification, max 80 char.
HDR.RID = 'recording identification';	% e.g. 'EMG561 BK/JOP Sony. MNC R Median Nerve.'

% recording time [YYYY MM DD hh mm ss.ccc]
HDR.T0 = clock;	

% number of channels
HDR.NS = size(x,2);

% Duration of one block in seconds
HDR.Dur = 1;

% Samples within 1 block
%HDR.SPR = [100;100;100;100;100];	% samples per block;
HDR.EDF.SampleRate = [100;100;100;100;100];	% samples per block;

% channel identification, max 80 char. per channel
HDR.Label=['chan 1  ';'chan 2  ';'chan 3  ';'chan 4  ';'chan 5  '];

% Transducer, mx 80 char per channel
HDR.Transducer = ['Ag-AgCl ';'Airflow ';'xyz     ';'        ';'        '];

% filter settings of each channel 
HDR.PreFilt = ['0-100Hz ';'0-100Hz ';'0-100Hz ';'none    ';'----    '];		% Prefiltering

% define datatypes (GDF only, see GDFDATATYPE.M for more details)
HDR.GDFTYP = 3*ones(1,HDR.NS);

% define scaling factors 
HDR.PhysMax = [100;100;100;100;100];
HDR.PhysMin = [0;0;0;0;0];
HDR.DigMax  = [100;100;100;100;100];
HDR.DigMin  = [0;0;0;0;0];

% define physical dimension
HDR.PhysDim = ['uV ';'   ';'   ';'   ';'   '];

t = [100:100:size(x,1)]';
HDR = sopen(HDR,'wb');
%HDR.SIE.RAW = 0; % [default] channel data mode, one column is one channel 
%HDR.SIE.RAW = 1; % switch to raw data mode, i.e. one column for one EDF-record
HDR = swrite(HDR,x);

HDR.EVENT.POS = t;
HDR.EVENT.TYP = t/100;
HDR = sclose(HDR);

[s0,HDR0] = sload(HDR.FileName);	% test file 

plot(s0-x)


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -