fs_write_wfile.m

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

M
33
字号
function fs_write_wfile(fname, w)

% FS_WRITE_WFILE - FREESURFER I/O function to write an overlay (*.w) file
%
% [w] = fs_write_wfile(fname, w)
% writes a vector into a binary 'w' file
%  fname - name of file to write to
%  w     - vector of values to be written, 
%          assumed sorted from vertex 1:N
%
% See also FS_READ_WFILE, FS_WRITE_SURF, FS_WRITE_CURV

if(nargin ~= 2)
    msg = sprintf('USAGE: [w] = fs_write_wfile(fname, w)\n');
    error(msg);
end

% open it as a big-endian file
fid = fopen(fname, 'wb', 'b') ;

vnum = length(w) ;

fwrite(fid, 0, 'int16') ; % latency integer
fs_fwrite3(fid, vnum) ;   % number of vertices
for i=1:vnum,
  fs_fwrite3(fid, i-1) ;  % FS vertices start at zero
  fwrite(fid, w(i), 'float') ;
end

fclose(fid) ;

return

⌨️ 快捷键说明

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