⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eegplot.m

📁 含有多种ICA算法的eeglab工具箱
💻 M
📖 第 1 页 / 共 5 页
字号:
        g.spacing = 1;    end;  end  % set defaults  % ------------   g.incallback = 0;  g.winstatus = 1;  g.setelectrode  = 0;  [g.chans,g.frames,tmpnb] = size(data);     g.frames = g.frames*tmpnb;  g.nbdat = 1; % deprecated  g.time  = 0;  g.elecoffset = 0;    % %%%%%%%%%%%%%%%%%%%%%%%%  % Prepare figure and axes  % %%%%%%%%%%%%%%%%%%%%%%%%    figh = figure('UserData', g,... % store the settings here      'Color',DEFAULT_FIG_COLOR, 'name', g.title,...      'MenuBar','none','tag', g.tag ,'Position',g.position, 'numbertitle', 'off', 'visible', 'off');  pos = get(figh,'position'); % plot relative to current axes  q = [pos(1) pos(2) 0 0];  s = [pos(3) pos(4) pos(3) pos(4)]./100;  clf;        % Background axis  % ---------------   ax0 = axes('tag','backeeg','parent',figh,...      'Position',DEFAULT_AXES_POSITION,...      'Box','off','xgrid','off', 'xaxislocation', 'top');   % Drawing axis  % ---------------   YLabels = num2str((1:g.chans)');  % Use numbers as default  YLabels = flipud(str2mat(YLabels,' '));  ax1 = axes('Position',DEFAULT_AXES_POSITION,...             'userdata', data, ...% store the data here (when in g, slow down display)   			'tag','eegaxis','parent',figh,...      'Box','on','xgrid', g.xgrid,'ygrid', g.ygrid,...      'gridlinestyle',DEFAULT_GRID_STYLE,...      'Xlim',[0 g.winlength*g.srate],...      'xtick',[0:g.srate*DEFAULT_GRID_SPACING:g.winlength*g.srate],...      'Ylim',[0 (g.chans+1)*g.spacing],...      'YTick',[0:g.spacing:g.chans*g.spacing],...      'YTickLabel', YLabels,...      'XTickLabel',num2str((0:DEFAULT_GRID_SPACING:g.winlength)'),...      'TickLength',[.005 .005],...      'Color','none',...      'XColor',DEFAULT_AXIS_COLOR,...      'YColor',DEFAULT_AXIS_COLOR);  if isstr(g.eloc_file) | isstruct(g.eloc_file)  % Read in electrode names      if isstruct(g.eloc_file) & length(g.eloc_file) > size(data,1)          g.eloc_file(end) = []; % common reference channel location      end;      eegplot('setelect', g.eloc_file, ax1);  end;    % %%%%%%%%%%%%%%%%%%%%%%%%%  % Set up uicontrols  % %%%%%%%%%%%%%%%%%%%%%%%%%% positions of buttons  posbut(1,:) = [ 0.0464    0.0254    0.0385    0.0339 ]; % <<  posbut(2,:) = [ 0.0924    0.0254    0.0288    0.0339 ]; % <  posbut(3,:) = [ 0.1924    0.0254    0.0299    0.0339 ]; % >  posbut(4,:) = [ 0.2297    0.0254    0.0385    0.0339 ]; % >>  posbut(5,:) = [ 0.1287    0.0203    0.0561    0.0390 ]; % Eposition  posbut(6,:) = [ 0.4744    0.0236    0.0582    0.0390 ]; % Espacing  posbut(7,:) = [ 0.2762    0.01    0.0582    0.0390 ]; % elec  posbut(8,:) = [ 0.3256    0.01    0.0707    0.0390 ]; % g.time  posbut(9,:) = [ 0.4006    0.01    0.0582    0.0390 ]; % value  posbut(14,:) = [ 0.2762    0.05    0.0582    0.0390 ]; % elec tag  posbut(15,:) = [ 0.3256    0.05    0.0707    0.0390 ]; % g.time tag  posbut(16,:) = [ 0.4006    0.05    0.0582    0.0390 ]; % value tag  posbut(10,:) = [ 0.5437    0.0458    0.0275    0.0270 ]; % +  posbut(11,:) = [ 0.5437    0.0134    0.0275    0.0270 ]; % -  posbut(12,:) = [ 0.6    0.02    0.14    0.05 ]; % cancel  posbut(13,:) = [-0.15   0.02    0.07    0.05 ]; % cancel  posbut(17,:) = [-0.06    0.02    0.09    0.05 ]; % events types  posbut(20,:) = [-0.17   0.15     0.015    0.8 ]; % slider  posbut(:,1) = posbut(:,1)+0.2;% Five move buttons: << < text > >>   u(1) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position', posbut(1,:), ...	'Tag','Pushbutton1',...	'string','<<',...	'Callback','eegplot(''drawp'',1)');  u(2) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position', posbut(2,:), ...	'Tag','Pushbutton2',...	'string','<',...	'Callback','eegplot(''drawp'',2)');  u(5) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',[1 1 1], ...	'Position', posbut(5,:), ...	'Style','edit', ...	'Tag','EPosition',...	'string', fastif(g.trialstag(1) == -1, '0', '1'),...	'Callback', 'eegplot(''drawp'',0);' );  u(3) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position',posbut(3,:), ...	'Tag','Pushbutton3',...	'string','>',...	'Callback','eegplot(''drawp'',3)');  u(4) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position',posbut(4,:), ...	'Tag','Pushbutton4',...	'string','>>',...	'Callback','eegplot(''drawp'',4)');% Text edit fields: ESpacing  u(6) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',[1 1 1], ...	'Position', posbut(6,:), ...	'Style','edit', ...	'Tag','ESpacing',...	'string',num2str(g.spacing),...	'Callback', 'eegplot(''draws'',0);' );% Slider for vertical motion  u(20) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position', posbut(20,:), ...   'Style','slider', ...   'visible', 'off', ...   'sliderstep', [0.9 1], ...   'Tag','eegslider', ...   'callback', [ 'tmpg = get(gcbf, ''userdata'');' ...    				'tmpg.elecoffset = get(gcbo, ''value'')*(tmpg.chans-tmpg.dispchans);' ...               'set(gcbf, ''userdata'', tmpg);' ...               'eegplot(''drawp'',0);' ...               'clear tmpg;' ], ...   'value', 0);% channels, position, value and tag  u(9) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position', posbut(7,:), ...	'Style','text', ...	'Tag','Eelec',...	'string',' ');  u(10) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position', posbut(8,:), ...	'Style','text', ...	'Tag','Etime',...	'string','0.00');  u(11) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position',posbut(9,:), ...	'Style','text', ...	'Tag','Evalue',...	'string','0.00');  u(14)= uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position', posbut(14,:), ...	'Style','text', ...	'Tag','Eelecname',...	'string','Chan.');  u(15) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position', posbut(15,:), ...	'Style','text', ...	'Tag','Etimename',...	'string','Time');  u(16) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'BackgroundColor',DEFAULT_FIG_COLOR, ...	'Position',posbut(16,:), ...	'Style','text', ...	'Tag','Evaluename',...	'string','Value');% ESpacing buttons: + -  u(7) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position',posbut(10,:), ...	'Tag','Pushbutton5',...	'string','+',...	'FontSize',8,...	'Callback','eegplot(''draws'',1)');  u(8) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position',posbut(11,:), ...	'Tag','Pushbutton6',...	'string','-',...	'FontSize',8,...	'Callback','eegplot(''draws'',2)');  if isempty(g.command) tmpcom = 'fprintf(''Rejections saved in variable TMPREJ\n'');';     else tmpcom = g.command;  end;  acceptcommand = [ 'g = get(gcbf, ''userdata'');' ... 				    'TMPREJ = g.winrej;' ...                    'if g.children, delete(g.children); end;' ...                    'delete(gcbf);' ...		  				  tmpcom ...                    'clear g;']; % quitting expression  if ~isempty(g.command)	  u(12) = uicontrol('Parent',figh, ...						'Units', 'normalized', ...						'Position',posbut(12,:), ...						'Tag','Accept',...						'string',g.butlabel, 'callback', acceptcommand);  end;  u(13) = uicontrol('Parent',figh, ...	'Units', 'normalized', ...	'Position',posbut(13,:), ...	'string',fastif(isempty(g.command),'CLOSE', 'CANCEL'), 'callback', ...		[	'g = get(gcbf, ''userdata'');' ...             'if g.children, delete(g.children); end;' ...			'close(gcbf);'] );  if ~isempty(g.events)      u(17) = uicontrol('Parent',figh, ...                        'Units', 'normalized', ...                        'Position',posbut(17,:), ...                        'string', 'Event types', 'callback', 'eegplot(''drawlegend'', gcbf)');  end;  set(u,'Units','Normalized')    % %%%%%%%%%%%%%%%%%%%%%%%%%%%  % Set up uimenus  % %%%%%%%%%%%%%%%%%%%%%%%%%%%    % Figure Menu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  m(7) = uimenu('Parent',figh,'Label','Figure');  m(8) = uimenu('Parent',m(7),'Label','Print');  uimenu('Parent',m(7),'Label','Edit figure', 'Callback', 'eegplot(''noui'');');  uimenu('Parent',m(7),'Label','Accept and close', 'Callback', acceptcommand );  uimenu('Parent',m(7),'Label','Cancel and 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)  % Print command %%%%%%%  uimenu('Parent',m(8),'Label','Print','tag','printcommand','callback',...  		['RESULT = inputdlg2( { ''Command:'' }, ''Print'', 1,  { ''print -r72'' });' ...		 'if size( RESULT,1 ) ~= 0' ... 		 '  eval ( RESULT{1} );' ...		 'end;' ...		 'clear RESULT;' ]);    % Display Menu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  m(1) = uimenu('Parent',figh,...      'Label','Display', 'tag', 'displaymenu');    % window grid %%%%%%%%%%%%%  % userdata = 4 cells : display yes/no, color, electrode yes/no, trial boundary adapt yes/no (1/0)    m(11) = uimenu('Parent',m(1),'Label','Marking color', 'tag', 'displaywin', ...				 'userdata', { 1, [0.8 1 0.8], 0, fastif( g.trialstag(1) == -1, 0, 1)} );  uimenu('Parent',m(11),'Label','Hide marks','Callback', ...  	['g = get(gcbf, ''userdata'');' ...  	 'if ~g.winstatus' ...   	 '  set(gcbo, ''label'', ''Hide marks'');' ...  	 'else' ...  	 '  set(gcbo, ''label'', ''Show marks'');' ...  	 'end;' ...  	 'g.winstatus = ~g.winstatus;' ...  	 'set(gcbf, ''userdata'', g);' ...  	 'eegplot(''drawb''); clear g;'] )	% color	uimenu('Parent',m(11),'Label','Choose color', 'Callback', ...  	[ 'g = get(gcbf, ''userdata'');' ...  	  'g.wincolor = uisetcolor(g.wincolor);' ...      'set(gcbf, ''userdata'', g ); ' ...      'clear g;'] )	% set channels	uimenu('Parent',m(11),'Label','Mark channels', 'enable', 'off', 'checked', 'off', 'Callback', ...  	['g = get(gcbf, ''userdata'');' ...  	 'g.setelectrode = ~g.setelectrode;' ...  	 'set(gcbf, ''userdata'', g); ' ...     'if ~g.setelectrode setgcbo, ''checked'', ''on''); else set(gcbo, ''checked'', ''off''); end;'...     ' clear g;'] )	% trials boundaries	%uimenu('Parent',m(11),'Label','Trial boundaries', 'checked', fastif( g.trialstag(1) == -1, 'off', 'on'), 'Callback', ...  	%['hh = findobj(''tag'',''displaywin'',''parent'', findobj(''tag'',''displaymenu'',''parent'', gcbf ));' ...  	% 'hhdat = get(hh, ''userdata'');' ...  	% 'set(hh, ''userdata'', { hhdat{1},  hhdat{2}, hhdat{3}, ~hhdat{4}} ); ' ...    %'if ~hhdat{4} set(gcbo, ''checked'', ''on''); else set(gcbo, ''checked'', ''off''); end;' ...     %' clear hh hhdat;'] )  % X grid %%%%%%%%%%%%  m(3) = uimenu('Parent',m(1),'Label','Grid');

⌨️ 快捷键说明

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