Home > vbmeg > external > mne > fiff_write_proj.m

fiff_write_proj

PURPOSE ^

SYNOPSIS ^

function fiff_write_proj(fid,projs)

DESCRIPTION ^

 fiff_write_proj(fid,projs)

 Writes the projection data into a fif file

     fid           An open fif file descriptor
     projs         The compensation data to write

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fiff_write_proj(fid,projs)
0002 %
0003 % fiff_write_proj(fid,projs)
0004 %
0005 % Writes the projection data into a fif file
0006 %
0007 %     fid           An open fif file descriptor
0008 %     projs         The compensation data to write
0009 %
0010 
0011 %
0012 %   Author : Matti Hamalainen, MGH Martinos Center
0013 %   License : BSD 3-clause
0014 %
0015 %   Revision 1.9  2008/08/06 17:31:11  msh
0016 %   Removed some debug output
0017 %
0018 %   Revision 1.8  2008/08/06 17:29:55  msh
0019 %   Fixed missing end in writing the projection time.
0020 %
0021 %   Revision 1.7  2008/05/09 11:02:09  msh
0022 %   Added FIFF_PROJ_ITEM_TIME for Neuromag compatibility
0023 %
0024 %   Revision 1.6  2008/05/06 20:40:56  msh
0025 %   Fixed ordering of output for compatibility with maxfilter averager
0026 %
0027 %   Revision 1.5  2006/05/03 18:53:05  msh
0028 %   Approaching Matlab 6.5 backward compatibility
0029 %
0030 %   Revision 1.4  2006/04/23 15:29:40  msh
0031 %   Added MGH to the copyright
0032 %
0033 %   Revision 1.3  2006/04/18 20:44:46  msh
0034 %   Added reading of forward solution.
0035 %   Use length instead of size when appropriate
0036 %
0037 %   Revision 1.2  2006/04/12 10:51:18  msh
0038 %   Added projection writing and compensation routines
0039 %
0040 %   Revision 1.1  2006/04/12 10:29:03  msh
0041 %   Made evoked data writing compatible with the structures returned in reading.
0042 %
0043 %
0044 
0045 me='MNE:fiff_write_proj';
0046 
0047 if nargin ~= 2
0048     error(me,'Incorrect number of arguments');
0049 end
0050 
0051 global FIFF;
0052 if isempty(FIFF)
0053     FIFF = fiff_define_constants();
0054 end
0055 
0056 if isempty(projs)
0057     return;
0058 end
0059 
0060 fiff_start_block(fid,FIFF.FIFFB_PROJ);
0061 for k = 1:length(projs)
0062     fiff_start_block(fid,FIFF.FIFFB_PROJ_ITEM);
0063     fiff_write_string(fid,FIFF.FIFF_NAME,projs(k).desc);
0064     fiff_write_int(fid,FIFF.FIFF_PROJ_ITEM_KIND,projs(k).kind);
0065     if projs(k).kind == FIFF.FIFFV_PROJ_ITEM_FIELD
0066         fiff_write_float(fid,FIFF.FIFF_PROJ_ITEM_TIME,0.0);
0067     end
0068     fiff_write_int(fid,FIFF.FIFF_NCHAN,projs(k).data.ncol);
0069     fiff_write_int(fid,FIFF.FIFF_PROJ_ITEM_NVEC, ...
0070         projs(k).data.nrow);
0071     fiff_write_int(fid,FIFF.FIFF_MNE_PROJ_ITEM_ACTIVE, ...
0072         projs(k).active);
0073     fiff_write_name_list(fid, ...
0074         FIFF.FIFF_PROJ_ITEM_CH_NAME_LIST, ...
0075         projs(k).data.col_names);
0076     fiff_write_float_matrix(fid,FIFF.FIFF_PROJ_ITEM_VECTORS,projs(k).data.data);
0077     fiff_end_block(fid,FIFF.FIFFB_PROJ_ITEM);
0078 end
0079 fiff_end_block(fid,FIFF.FIFFB_PROJ);
0080 
0081 return;
0082 
0083 
0084 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005