eeg_write.m

来自「Matlab下的EEG处理程序库」· M 代码 · 共 40 行

M
40
字号
function eeg_write(file,data,PRECISION)
% EEG_WRITE - Write matrix of EEG data into binary file
%
% Useage:   eeg_write(file,data,PRECISION)
%
% where:    'file' is the path + filename, eg "c:\data.dat"
%           'data' is a matlab variable
%           'PRECISION' is a binary format ('double' default, see fread)
%
% comment:  Uses the fwrite method to output both 'size(data)' and
%           data. The size(data) integers are written first and used
%           by 'eeg_load' to determine the size of the data matrix.
%           All files are 'ieee-le'.
%

% $Revision: 1.2 $ $Date: 2003/03/02 03:20:43 $

% Licence:  GNU GPL, no express or implied warranties
% History:  07/2001, Darren.Weber@flinders.edu.au
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~exist('PRECISION','var'), PRECISION = 'double'; end

[path,name,ext] = fileparts(file);
file = fullfile(path,[name ext]);

fid = fopen(file,'w','ieee-le');

% Write magicN data file size
magicN = size(data);
count = fwrite(fid,magicN,'int');
    
% Write the rest of the data
count = fwrite(fid,data,PRECISION);  fclose(fid);

fprintf('EEG_WRITE: Wrote %d bytes to:\t%s\n', count, file);

return

⌨️ 快捷键说明

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