Home > eeg > egis > scripts > plot_ns_data.m

plot_ns_data

PURPOSE ^

bad_chan= plot_ns_data(seconds,reference,channels,Max_microv,freqs,rawfname);

SYNOPSIS ^

function bad_chan= plot_ns_data(seconds,reference,chans,Max_microv,freqs,rawfname);

DESCRIPTION ^

bad_chan= plot_ns_data(seconds,reference,channels,Max_microv,freqs,rawfname);

seconds = seconds from start of file to grab data, e.g., [1:4] or [5] or [97:111]
reference = reference to use (see new_reference.m) (optional)
        options: 'average', 'avgmast', 'perimeter', 'vertex',or a channel list
         defaults to 'average'
        can also be used to invoke laplacian: 'laplacian'
        can also be used to invoke cortical filtering: 'cortical05'
            or 'cortical10' where the number indicates the
            smoothing level
data is alway zeromeaned channel by channel
channels = list of channels to plot (defaults to 10_20)
Max_microv = maximum microvolt level at channels (optional)
                defaults to 100
freqs = frequency plot if skipped or [] then 
no spectral plot
rawfname = filename (optional)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bad_chan= plot_ns_data(seconds,reference,chans,Max_microv,freqs,rawfname);
0002 %bad_chan= plot_ns_data(seconds,reference,channels,Max_microv,freqs,rawfname);
0003 %
0004 %seconds = seconds from start of file to grab data, e.g., [1:4] or [5] or [97:111]
0005 %reference = reference to use (see new_reference.m) (optional)
0006 %        options: 'average', 'avgmast', 'perimeter', 'vertex',or a channel list
0007 %         defaults to 'average'
0008 %        can also be used to invoke laplacian: 'laplacian'
0009 %        can also be used to invoke cortical filtering: 'cortical05'
0010 %            or 'cortical10' where the number indicates the
0011 %            smoothing level
0012 %data is alway zeromeaned channel by channel
0013 %channels = list of channels to plot (defaults to 10_20)
0014 %Max_microv = maximum microvolt level at channels (optional)
0015 %                defaults to 100
0016 %freqs = frequency plot if skipped or [] then
0017 %no spectral plot
0018 %rawfname = filename (optional)
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

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