Home > database > analysis_txt2file.m

analysis_txt2file

PURPOSE ^

Writes textual responses from the analysis structure out to a file.

SYNOPSIS ^

function analysis_txt2file(as,fname)

DESCRIPTION ^

 Writes textual responses from the analysis structure out to a file.

 analysis_txt2file(as,fname)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function analysis_txt2file(as,fname)
0002 % Writes textual responses from the analysis structure out to a file.
0003 %
0004 % analysis_txt2file(as,fname)
0005 %
0006 
0007 % 08/20/05 PJ
0008 % 10/25/05 PJ  -- Fixed handling of empty stimidx field
0009 
0010 td = as.txt;
0011 
0012 nsubs = length(td.subid);
0013 nquest = length(td.qid);
0014 
0015 max_stims = size(td.data,3);
0016 
0017 fid = fopen(fname,'wt');
0018 fprintf(fid,'Question\tSubject\tStimID\tResponse\n');
0019 for iq = 1:nquest
0020   fprintf(fid,'\n%s\n',td.qtxt{iq});
0021   for isub = 1:nsubs
0022     fprintf(fid,'\n\t%s\n', td.subid{isub});
0023     for istim = 1:max_stims
0024       if td.niter(isub,iq) && ~isempty(td.data{isub,iq,istim})
0025     if ~isempty(td.stimidx)
0026       stim_id = as.stims.ids(td.stimidx(isub,istim));
0027       stim_str = sprintf('%d', stim_id);
0028     else
0029       stim_str = '';
0030     end
0031     fprintf(fid,'\t\t%s\t%s\n', stim_str, td.data{isub,iq,istim});
0032       end
0033     end % for istim
0034   end % for isub=
0035 end % for iquest
0036 fclose(fid);
0037 
0038 return

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003