Permalink
Browse files

Added method 8

  • Loading branch information...
1 parent 89b80b8 commit 2c3eca2f739f0a4e4e25f6bcd60d089ade4787d3 @widmann committed Aug 17, 2007
Showing with 26 additions and 7 deletions.
  1. +26 −7 writecntriffdata.m
View
@@ -1,6 +1,11 @@
% $Id$
-function epochOffsetArray = writeriffdata(fid, data, epochLength)
+function epochOffsetArray = writecntriffdata(fid, data, epochLength, compMeth)
+
+% Compression method
+if nargin < 4 || isempty(compMeth)
+ compMeth = 12; % Float vectors
+end
% Epoch length
if nargin < 3
@@ -19,14 +24,28 @@
epochOffsetArray(iEpoch) = ftell(fid) - chunkOffset;
for iChan = 1:size(data, 1)
+
+ switch compMeth
+
+ % Uncompressed 32 bit integer
+ case 8
+ % Write data format and compression information
+ fwrite(fid, 128, 'uint8');
+
+ % Write data
+ fwrite(fid, data(iChan, epochArray(iEpoch) + 1:epochArray(iEpoch + 1)), 'int32', 'b'); % Big endian!
+
+ % EEP 4.0 average (float vectors)
+ case 12
+ % Write data format and compression information
+ fwrite(fid, 12, 'uint8');
- % Write data format and compression information (currently
- % only 32 bit float w/o compression)
- fwrite(fid, 12, 'ubit4');
- fwrite(fid, 0, 'ubit4');
+ % Write data
+ fwrite(fid, data(iChan, epochArray(iEpoch) + 1:epochArray(iEpoch + 1)), 'float32');
- % Write data
- fwrite(fid, data(iChan, epochArray(iEpoch) + 1:epochArray(iEpoch + 1)), 'float32');
+ otherwise
+ error('Unkown compression method.')
+ end
end

0 comments on commit 2c3eca2

Please sign in to comment.