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