0001 function bad_chan= plot_ns_data(seconds,reference,chans,Max_microv,freqs,rawfname);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 if nargin < 1
0021 error('seconds not specified');
0022 end;
0023 if (nargin < 2);
0024 reference = 'average';
0025 end;
0026 if isempty(reference);
0027 reference = 'average';
0028 end;
0029 if (nargin < 3);
0030 chans = [9 11 23 25 34 37 46 58 60 62 71 84 86 97 105 109 122 124 129];
0031 end;
0032 if chans == []
0033 chans = [9 11 23 25 34 37 46 58 60 62 71 84 86 97 105 109 122 124 129];
0034 end
0035 if (nargin < 4)
0036 Max_microv = 100;
0037 end
0038 if Max_microv == [];
0039 Max_microv = 100;
0040 end;
0041 if nargin < 6
0042 [ref_trialdata, bad_chan] = grab_ns_data(seconds,reference,Max_microv);
0043 else
0044 [ref_trialdata, bad_chan] = grab_ns_data(seconds,reference,Max_microv,rawfname);
0045 end;
0046 max_trialdata = max(max(abs(ref_trialdata(:,chans))));
0047 max_trialdata = max_trialdata*1.1;
0048 step = size(seconds,2)/size(ref_trialdata,1);
0049 time = [step:step:size(seconds,2)];
0050 time = time+min(seconds)*ones(1,size(time,2));
0051 figure
0052 for i = 1:size(chans,2)
0053 hold on,plot(time,ref_trialdata(:,chans(i))+(i-1)*max_trialdata*ones(size(ref_trialdata,1),1),'k-')
0054 hold on, plot([min(time)-0.25 max(time)+0.25],[(i-1)*max_trialdata (i-1)*max_trialdata],'k--')
0055 hold on, text(max(time)+0.4,(i-1)*max_trialdata,int2str(chans(i)));
0056 end
0057 xlabel('Time (seconds)')
0058 ylabel('Microvolts')
0059 if nargin > 4
0060 if freqs ~= []
0061 figure
0062 fft_trial = abs(fft(ref_trialdata(:,chans)));
0063 max_fft = max(max(fft_trial));
0064 frequency = [0:fix(size(fft_trial,1)/2)-1]/size(seconds,2);
0065 for i = 1:size(chans,2)
0066 hold on,plot(frequency,fft_trial(1:size(frequency,2),i)+(i-1)*max_fft*ones(size(frequency,2),1),'k-')
0067 hold on,axis([freqs(1) freqs(2) 0 size(chans,2)*max_fft ])
0068 hold on, plot([min(freqs)-1 max(freqs)*1.1],[(i-1)*max_fft (i-1)*max_fft],'k--')
0069 hold on, text(max(freqs)*0.75,(i-0.5)*max_fft,int2str(chans(i)));
0070
0071 end
0072 end
0073 end
0074
0075