eegplotold.m

来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 1,005 行 · 第 1/3 页

M
1,005
字号
% eegplotold() - display data in a horizontal scrolling fashion %                with (optional) gui controls (version 2.3)% Usage: %   >> eegplotold(data,srate,spacing,eloc_file,windowlength,title)%   >> eegplotold('noui',data,srate,spacing,eloc_file,startpoint,color)%% Inputs:%   data         - Input data matrix (chans,timepoints) %   srate        - Sampling rate in Hz {default|0: 256 Hz}%   spacing      - Space between channels (default|0: max(data)-min(data))%   eloc_file    - Electrode filename as in >> topoplot example%                  [] -> no labels; default|0 -> integers 1:nchans%                  vector of integers -> channel numbers%   windowlength - Number of seconds of EEG displayed {default 10 s}%   color        - EEG plot color {default black/white}%   'noui'       - Display eeg in current axes without user controls%% Author: Colin Humphries, CNL, Salk Institute, La Jolla, 5/98%% See also: eegplot(), eegplotold(), eegplotsold()% Copyright (C) Colin Humphries, CNL, Salk Institute 3/97 from eegplotold()%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA% Runs under Matlab 5.0+ (not supported for Matlab 4)% Edit History:% 5-14-98 v2.1 fixed bug for small-variance data -ch% 1-31-00 v2.2 exchanged meaning of > and >>, < and << -sm% 8-15-00 v2.3 turned on SPACING_EYE and added int vector input for eloc_file -sm% 12-16-00 added undocumented figure position arg (if not 'noui') -sm% 01-25-02 reformated help & license, added links -ad function [outvar1] = eegplotold(data,p1,p2,p3,p4,p5,p6)% Defaults (can be re-defined):DEFAULT_ELOC_FILE = 0;            % Default electrode name file                                  %   [] - none, 0 - numbered, or filenameDEFAULT_SAMPLE_RATE = 256;        % Samplerate DEFAULT_PLOT_COLOR = 'k';         % EEG line colorDEFAULT_AXIS_BGCOLOR = [.8 .8 .8];% EEG Axes Background ColorDEFAULT_FIG_COLOR = [.8 .8 .8];   % Figure Background ColorDEFAULT_AXIS_COLOR = 'k';         % X-axis, Y-axis Color, text ColorDEFAULT_WINLENGTH = 10;           % Number of seconds of EEG displayedDEFAULT_GRID_SPACING = 1;         % Grid lines every n secondsDEFAULT_GRID_STYLE = '-';         % Grid line styleYAXIS_NEG = 'off';                % 'off' = positive up DEFAULT_NOUI_PLOT_COLOR = 'k';    % EEG line color for noui option                                  %   0 - 1st color in AxesColorOrderDEFAULT_TITLEVAL = 2;             % Default title                                  %   string, 2 - variable name, 0 - noneSPACING_EYE = 'on';               % spacing I on/offSPACING_UNITS_STRING = '\muV';    % optional units for spacing I Ex. uVDEFAULT_AXES_POSITION = [0.0964286 0.15 0.842 0.788095];                                  % dimensions of main EEG axesif nargin<1   help eegplotold   returnend				  % %%%%%%%%%%%%%%%%%%%%%%%%% Setup inputs% %%%%%%%%%%%%%%%%%%%%%%%%if ~isstr(data) % If NOT a 'noui' call or a callback from uicontrols  if nargin == 7  % undocumented feature - allows position to be specd.    posn = p6;  else    posn = NaN;  end  % if strcmp(YAXIS_NEG,'on')  %   data = -data;  % end  if nargin < 6    titleval = 0;  else    titleval = p5;  end  if nargin < 5    winlength = 0;  else    winlength = p4;  end  if nargin < 4    eloc_file = DEFAULT_ELOC_FILE;  else    eloc_file = p3;  end  if nargin < 3    spacing = 0;  else    spacing = p2;  end  if nargin < 2    Fs = 0;  else    Fs = p1;  end  if isempty(titleval)    titleval = 0;  end  if isempty(winlength)    winlength = 0;  end  if isempty(spacing)    spacing = 0;  end  if isempty(Fs)    Fs = 0;  end      [chans,frames] = size(data);    if winlength == 0    winlength = DEFAULT_WINLENGTH;  % Set window length  end    if ischar(eloc_file)           % Read in electrode names    fid = fopen(eloc_file);       % Read file    if fid < 1      error('error opening electrode file')    end    YLabels = fscanf(fid,'%d %f %f%s',[7 128]);    fclose(fid);    YLabels = char(YLabels(4:7,:)');    ii = find(YLabels == '.');    YLabels(ii) = ' ';    YLabels = flipud(str2mat(YLabels,' '));  elseif length(eloc_file) == chans    YLabels = num2str(eloc_file');  elseif length(eloc_file) == 1 & eloc_file(1) == 0    YLabels = num2str((1:chans)');  % Use numbers  else    YLabels = [];    % no labels used  end  YLabels = flipud(str2mat(YLabels,' '));    if spacing == 0    spacing = (max(max(data')-min(data')));  % Set spacing to max/min data    if spacing > 10      spacing = round(spacing);    end  end    if titleval == 0      titleval = DEFAULT_TITLEVAL;  % Set title value  end    if Fs == 0    Fs = DEFAULT_SAMPLE_RATE;     % Set samplerate  end    % %%%%%%%%%%%%%%%%%%%%%%%%  % Prepare figure and axes  % %%%%%%%%%%%%%%%%%%%%%%%%    if isnan(posn) % no user-supplied position vector   figh = figure('UserData',[winlength Fs],...      'Color',DEFAULT_FIG_COLOR,...      'MenuBar','none','tag','eegplotold');  else   figh = figure('UserData',[winlength Fs],...      'Color',DEFAULT_FIG_COLOR,...      'MenuBar','none','tag','eegplotold','Position',posn);  end %entry   ax1 = axes('tag','eegaxis','parent',figh,...      'userdata',data,...      'Position',DEFAULT_AXES_POSITION,...      'Box','on','xgrid','on',...      'gridlinestyle',DEFAULT_GRID_STYLE,...      'Xlim',[0 winlength*Fs],...      'xtick',[0:Fs*DEFAULT_GRID_SPACING:winlength*Fs],...      'Ylim',[0 (chans+1)*spacing],...      'YTick',[0:spacing:chans*spacing],...      'YTickLabel',YLabels,...      'XTickLabel',num2str((0:DEFAULT_GRID_SPACING:winlength)'),...      'TickLength',[.005 .005],...      'Color',DEFAULT_AXIS_BGCOLOR,...      'XColor',DEFAULT_AXIS_COLOR,...      'YColor',DEFAULT_AXIS_COLOR);    if isstr(titleval)      % plot title    title(titleval)  elseif titleval == 2    title(inputname(1))  end    % %%%%%%%%%%%%%%%%%%%%%%%%%  % Set up uicontrols  % %%%%%%%%%%%%%%%%%%%%%%%%%  % Four move buttons: << < > >>  u(1) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[49.1294 12.7059 50.8235 16.9412], ...	'Tag','Pushbutton1',...	'string','<<',...	'Callback','eegplotold(''drawp'',1)');  u(2) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[105.953 12.7059 33.0353 16.9412], ...	'Tag','Pushbutton2',...	'string','<',...	'Callback','eegplotold(''drawp'',2)');  u(3) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[195.882 12.7059 33.8824 16.9412], ...	'Tag','Pushbutton3',...	'string','>',...	'Callback','eegplotold(''drawp'',3)');  u(4) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[235.765 12.7059 50.8235 16.9412], ...	'Tag','Pushbutton4',...	'string','>>',...	'Callback','eegplotold(''drawp'',4)');% Text edit fields: EPosition ESpacing  u(5) = uicontrol('Parent',figh, ...	'Units','points', ...	'BackgroundColor',[1 1 1], ...	'Position',[144.988 10.1647 44.8941 19.4824], ...	'Style','edit', ...	'Tag','EPosition',...	'string','0',...	'Callback','eegplotold(''drawp'',0)');  u(6) = uicontrol('Parent',figh, ...	'Units','points', ...	'BackgroundColor',[1 1 1], ...	'Position',[379.482-30 11.8 46.5882 19.5], ...	'Style','edit', ...	'Tag','ESpacing',...	'string',num2str(spacing),...	'Callback','eegplotold(''draws'',0)');% ESpacing buttons: + -  u(7) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[435-30 22.9 22 13.5], ...	'Tag','Pushbutton5',...	'string','+',...	'FontSize',8,...	'Callback','eegplotold(''draws'',1)');  u(8) = uicontrol('Parent',figh, ...	'Units','points', ...	'Position',[435-30 6.7 22 13.5], ...	'Tag','Pushbutton6',...	'string','-',...	'FontSize',8,...	'Callback','eegplotold(''draws'',2)');  set(u,'Units','Normalized')    % %%%%%%%%%%%%%%%%%%%%%%%%%%%  % Set up uimenus  % %%%%%%%%%%%%%%%%%%%%%%%%%%%    % Figure Menu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  m(7) = uimenu('Parent',figh,'Label','Figure');  m(8) = uimenu('Parent',m(7),'Label','Orientation');  uimenu('Parent',m(7),'Label','Close',...      'Callback','delete(gcbf)')    % Portrait %%%%%%%%  timestring = ['[OBJ1,FIG1] = gcbo;',...	        'PANT1 = get(OBJ1,''parent'');',...	        'OBJ2 = findobj(''tag'',''orient'',''parent'',PANT1);',...		'set(OBJ2,''checked'',''off'');',...		'set(OBJ1,''checked'',''on'');',...		'set(FIG1,''PaperOrientation'',''portrait'');',...		'clear OBJ1 FIG1 OBJ2 PANT1;'];		  uimenu('Parent',m(8),'Label','Portrait','checked',...      'on','tag','orient','callback',timestring)    % Landscape %%%%%%%  timestring = ['[OBJ1,FIG1] = gcbo;',...	        'PANT1 = get(OBJ1,''parent'');',...	        'OBJ2 = findobj(''tag'',''orient'',''parent'',PANT1);',...		'set(OBJ2,''checked'',''off'');',...		'set(OBJ1,''checked'',''on'');',...		'set(FIG1,''PaperOrientation'',''landscape'');',...		'clear OBJ1 FIG1 OBJ2 PANT1;'];    uimenu('Parent',m(8),'Label','Landscape','checked',...      'off','tag','orient','callback',timestring)    % Display Menu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  m(1) = uimenu('Parent',figh,...      'Label','Display');    % X grid %%%%%%%%%%%%  m(3) = uimenu('Parent',m(1),'Label','X Grid');    timestring = ['FIGH = gcbf;',...	        'AXESH = findobj(''tag'',''eegaxis'',''parent'',FIGH);',...		'set(AXESH,''xgrid'',''on'');',...		'clear FIGH AXESH;'];  uimenu('Parent',m(3),'Label','on','Callback',timestring)  timestring = ['FIGH = gcbf;',...	        'AXESH = findobj(''tag'',''eegaxis'',''parent'',FIGH);',...		'set(AXESH,''xgrid'',''off'');',...		'clear FIGH AXESH;'];  uimenu('Parent',m(3),'Label','off','Callback',timestring)    % Y grid %%%%%%%%%%%%%  m(4) = uimenu('Parent',m(1),'Label','Y Grid');  timestring = ['FIGH = gcbf;',...	        'AXESH = findobj(''tag'',''eegaxis'',''parent'',FIGH);',...		'set(AXESH,''ygrid'',''on'');',...		'clear FIGH AXESH;'];    uimenu('Parent',m(4),'Label','on','Callback',timestring)  timestring = ['FIGH = gcbf;',...	        'AXESH = findobj(''tag'',''eegaxis'',''parent'',FIGH);',...		'set(AXESH,''ygrid'',''off'');',...

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?