Home > functions > device > active_check > vb_plot_bad_trial.m

vb_plot_bad_trial

PURPOSE ^

SYNOPSIS ^

function try_list = vb_plot_bad_trial(data,ix_try,flg)

DESCRIPTION ^

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    try_list = vb_plot_bad_trial(data,ix_try,flg)
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 NXfig=2; NYfig=4; 
0007 nfig = 0;
0008 pfig = 1;
0009 print_mode = 0;
0010 basename = 'bad_trial';
0011 ymax = 100;
0012 
0013 [Nch, T, Ntry] = size(data);
0014 
0015 % Bad Trial
0016 Nbad  = length(ix_try);
0017 
0018 dtitle = 'Input Bad trial numbers';
0019 prompt = {'Bad trial numbers'};
0020 
0021 try_list = [];
0022 try_temp = [];
0023 
0024 figure;
0025 
0026 for n=1:Nbad
0027     ntry = ix_try(n);
0028     try_temp = [try_temp; ntry];
0029     
0030     nfig = nfig + 1; subplot(NYfig,NXfig,nfig); 
0031     
0032     ch = find(flg(:,ntry) > 0);
0033     y  = data(ch,:,ntry);
0034     plot(y')
0035     xlim([0 T])
0036     ylim([-ymax ymax])
0037     title(sprintf('Trial = %d',ntry))
0038 
0039     if nfig ==NXfig*NYfig | n==Nbad, 
0040         if print_mode==1
0041             fname = sprintf('%s%d.png',basename,pfig);
0042             pfig=pfig+1;
0043             orient landscape
0044             %orient portrait
0045             print(gcf,'-dpng',fname)
0046             clf;
0047         else
0048             fmode = menu('All Trials are Bad ?',...
0049                     'YES','NO');
0050     
0051             if fmode == 2,
0052                 answer = inputdlg(prompt,dtitle);
0053                 try_temp = sscanf(answer{1},'%d');
0054                 %try_temp = vb_setdiff2(try_temp,try_good);
0055             end
0056             try_list = [try_list; try_temp];
0057             try_temp = [];
0058         end
0059         clf; nfig=0; 
0060     end;
0061 
0062 end
0063 
0064 close
0065 
0066 %try_good = vb_setdiff2([1:Ntry],try_list);
0067 
0068 return

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005