Debian Codegraph @

biosig4c++/test0/test01.m

raw
1 %%% Octave script for testing BioSig4C++:SAVE2GDF
2
3 % $Id: test01.m,v 1.3 2007-08-30 12:41:17 schloegl Exp $
4 % Copyright (c) 2007 by Alois Schloegl <[email protected]>
5 % This file is part of the biosig project http://biosig.sf.net/
6
7 % This program is free software; you can redistribute it and/or
8 % modify it under the terms of the GNU General Public License
9 % as published by the Free Software Foundation; either version 2
10 % of the License, or (at your option) any later version.
11 %
12 % This program is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16 %
17 % You should have received a copy of the GNU General Public License
18 % along with this program; if not, write to the Free Software
19 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 pfad=pwd;
22 cd ..
23
24 [s,m]=unix('make'); %% compile save2gdf
25 if (s>0),
26 fprintf(1,'this script must be started from within .../biosig4c++/test0/ directory!\n');
27 end;
28 [s,m]=unix('make testhl7'); %% run test for HL7 file
29 [s,m]=unix('make testscp'); %% run test for SCP file
30
31
32 fn = dir('/tmp/t1.*');
33 clear s HDR
34 for k=1:length(fn),
35 try
36 [s{k},H]=sload(fullfile('/tmp',fn(k).name),0,'UCAL','ON','OVERFLOWDETECTION','OFF');
37 %[H]=sopen(fullfile('/tmp',fn(k).name),'r',0);
38 %[H]=sopen(fn(k).name,'r',0);
39 %H.FLAG.UCAL=1;
40 %H.FLAG.OVERFLOWDETECTION=0;
41 %[s{k},H]=sread(H);
42 %H = sclose(H);
43 HDR{k}=H;
44 [t,scale]=physicalunits(H.PhysDimCode);
45 s{k} = s{k}*diag(scale);
46
47 r = rms(s{k});
48 r1 = std(s{k});
49 R(k,1:length(r1))=r1;
50 fprintf(1,'%02i %s: [%s] %e %e %e %e\n',k,H.FileName,H.PhysDim{1},r(1:4));
51 catch ; end;
52 end;
53
54 for k=1:length(HDR)
55 try
56 fprintf(1,'%02i %-32s: [%s] %e %e %e %e\n',k, HDR{k}.FileName,HDR{k}.PhysDim{1},R(k,1:4));
57 catch
58 end;
59 end;
60
61 cd(pfad);