Home > src > exportToTable.m

exportToTable

PURPOSE ^

This function outputs variables in tab delimited file for further

SYNOPSIS ^

function exportToTable( dataStruct, features, file )

DESCRIPTION ^

 This function outputs variables in tab delimited file for further
 analysis
 Samuel Rivera
  Jun 22, 2014
 syntax: exportToTable( dataStruct, features, file )
 
 Inputs:
   dataStruct: returned from 'loadFromTable'
   featureVect:  (d x N)  matrix of features to export

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % This function outputs variables in tab delimited file for further
0002 % analysis
0003 % Samuel Rivera
0004 %  Jun 22, 2014
0005 % syntax: exportToTable( dataStruct, features, file )
0006 %
0007 % Inputs:
0008 %   dataStruct: returned from 'loadFromTable'
0009 %   featureVect:  (d x N)  matrix of features to export
0010 
0011 
0012 function exportToTable( dataStruct, features, file )
0013 
0014 nSub = length(dataStruct.sampsPerSubj);
0015 subject = cell(nSub,1);
0016 trial = cell(nSub,1);
0017 
0018 for i1 = 1:nSub
0019     subject{i1} = i1*ones( dataStruct.sampsPerSubj(i1),1);
0020     trial{i1} = (1:dataStruct.sampsPerSubj(i1))';
0021 end
0022 subject = cell2mat( subject);
0023 trial = cell2mat(trial);
0024 
0025 % write header
0026 fID = fopen( file, 'w');
0027 fprintf( fID, 'subject\ttrial\tlabel');
0028 for i1 =1:size(features,1)
0029     fprintf( fID, '\tvar_%d', i1);
0030 end
0031 fprintf( fID, '\n');
0032 fclose(fID);
0033 
0034 % write features
0035 dlmwrite( file, [ subject trial dataStruct.allLabels' features' ],'delimiter', '\t', '-append');

Generated on Wed 20-Jan-2016 11:50:43 by m2html © 2005