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

📄 plotdata.m

📁 含有多种ICA算法的eeglab工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
% plotdata() - plot concatenated multichannel data epochs in two-column format%% Usage:   >> plotdata(data)%          >> plotdata(data,frames)%          >> plotdata(data,frames,limits,title,channames,colors,rtitle,ydir) %% Inputs:%   data       = data consisting of consecutive epochs of (chans,frames) %   frames     = time frames/points per epoch {0 -> data length}%  [limits]    = [xmin xmax ymin ymax]  (x's in ms) %                {0 (or both y's 0) -> use data limits)%  'title'     = plot title {0 -> none}%  'channames' = channel location file or structure (see readlocs())%  'colors'    = file of color codes, 3 chars per line  %                ( '.' = space) {0 -> default color order}%  'rtitle'    = right-side plot title {0 -> none}%  ydir        = y-axis polarity (pos-up = 1; neg-up = -1) {def -> pos-up}%% Authors: Scott Makeig & Tzyy-Ping Jung, SCCN/INC/UCSD, La Jolla, 05-01-96 %% See also: plottopo(), timtopo(), envtopo(), headplot(), compmap(), eegmovie()% Copyright (C) 05-01-96 Scott Makeig & Tzyy-Ping Jung, SCCN/INC/UCSD, % scott@sccn.ucsd.edu%% 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% $Log: plotdata.m,v $% Revision 1.10  2004/07/26 21:11:37  arno% fixed problem if flat channel%% Revision 1.9  2003/07/25 17:39:14  arno% allowing to plot more trials%% Revision 1.8  2003/03/05 16:32:02  arno% plotting lines after data%% Revision 1.7  2002/10/20 21:30:33  arno% normalization for all plots%% Revision 1.6  2002/10/16 15:54:22  arno% nothing%% Revision 1.5  2002/10/13 23:54:18  arno% implmenting nan_mean%% Revision 1.4  2002/09/05 15:46:04  arno% update header%% Revision 1.3  2002/08/15 00:43:31  arno% corrected fontsize and plot problem%% Revision 1.2  2002/08/12 21:14:25  arno% updating error message%% Revision 1.1  2002/04/05 17:36:45  jorn% Initial revision%% 5-1-96 from showerps.m  -sm from showerp.m -tpj% 5-3-96 added default channel numbering, frames & title -sm% 5-17-96 added nargin tests below -sm% 5-21-96 added right titles -sm% 6-29-96 removed Postscript file query -sm% 7-22-96 restored lines to fill printed page with figure -sm% 7-29-96 added [channumbers] option for channames argument. -sm%         changed "channels" argument to "channames" in help statement above -sm% 1-6-97  debugged min/max time and +/- printing -tpj & sm% 3-3-97  restored previous Default axis parameters at end -sm% 4-2-97  debugged 32-epoch plotting -sm% 5-10-97 added no-args check -sm% 5-20-97 read icadefs.m for MAXPLOTDATACHANS and MAXPLOTDATAEPOCHS -sm% 6-23-97 use returns instead of errorcodes -sm% 10-31-97 use normalized PaperUnits for US/A4 compatibility, %          fixed [xy]{min,max} printing, added clf, adding Clipping off,%          fixed scaling, added limits tests -sm & ch% 11-19-97 removed an 'orient' command that caused problems printing -sm% 07-15-98 added 'ydir' arg, made pos-up the default -sm% 07-24-98 fixed 'ydir' arg, and pos-up default -sm% 01-02-99 added warning about frames not dividing data length -sm% 02-19-99 debugged axis limits -sm% 11-21-01 add compatibility to load .loc files for channames -ad% 01-25-02 reformated help & license, added links -ad % 02-16-02 added axcopy -ad & sm% 03-15-02 added readlocs and the use of eloc input structure -ad % 03-15-02 added smart axcopy -ad function plotdata(data,frames,limits,plottitle,channels,colors,righttitle,ydr)if nargin < 1,    help plotdata    returnend%% Set defaults%FONTSIZE = 12;     % font size to use for labelsTICKFONTSIZE=12;   % font size to use for axis labelsDEFAULT_SIGN = 1;  % default to plotting positive-up (1) or negative-up (-1)ISSPEC = 0;        % default - 0 = not spectral data, 1 = pos-only spectraaxcolor= get(0,'DefaultAxesXcolor'); % find what the default x-axis color isplotfile = 'plotdata.ps';ls_plotfile = 'ls -l plotdata.ps';%%%%%%%%%%%%%%%%%%%%%%%%%%% Substitute defaults for missing parameters %%%%%%SIGN = DEFAULT_SIGN;if nargin < 8   ydr = 0;endif ydr == -1   SIGN = -1;endif nargin < 7,    righttitle = 0; end;if nargin < 6    colors = 0;endif nargin < 5    channels = [1:size(data,1)]; % default channames = 1:chansendif nargin < 4    plottitle = 0; %CJHendlimitset = 0;if nargin < 3,    limits = 0;elseif length(limits)>1    limitset = 1;endif nargin < 2,    frames = 0;end    %%%%%%%%%%%%%%%%%%%%%%%%%%% Test parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  [chans,framestotal]=size(data);             % data size  if frames <=0,    frames = framestotal;    % default    datasets=1;  elseif frames==1,    fprintf('plotdata: cannot plot less than 2 frames per trace.\n');    return    datasets=1;  else    datasets = fix(framestotal/frames);        % number of traces to overplot    if datasets*frames < framestotal         fprintf('\nWARNING: %d points at end of data will not be plotted.\n',...                    framestotal-datasets*frames);    end  end;  icadefs; % read MAXPLOTDATACHANS constant from icadefs.m  if chans>MAXPLOTDATACHANS,    fprintf('plotdata: not set up to plot more than %d channels.\n',...                       MAXPLOTDATACHANS);    return  end;  if datasets>MAXPLOTDATAEPOCHS       fprintf('plotdata: not set up to plot more than %d epochs.\n',...                       MAXPLOTDATAEPOCHS);    return  end;  if datasets<1      fprintf('plotdata: cannot plot less than 1 epoch!\n');      return  end;%%%%%%%%%%%%%% Extend the size of the plotting area in the window %%%%%%%%%%%%%  curfig = gcf;  h=figure(curfig);  set(h,'Color',BACKCOLOR); % set the background color  set(h,'PaperUnits','normalized'); % use percentages to avoid US/A4 difference  set(h,'PaperPosition',[0.0235308 0.0272775 0.894169 0.909249]); % equivalent  % orient portrait  axis('normal');%%%%%%%%%%%%%%%%%%%%% Read the channel names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  if isnumeric(channels) & channels(1)==0,    channels = [1:size(data,1)];  end;  if isnumeric(channels),      channames = num2str(channels(:));                   %%CJH  else      [tmp channames] = readlocs(channels);      channames = strvcat(channames{:});  end;       %    chid = fopen(channels,'r');%    if chid <3,%        fprintf('plotdata(): cannot open file %s.\n',channels);%        return%     end;%     if isempty( findstr( lower(channels), '.loc') )%    		channames = fscanf(chid,'%s',[4 Inf]);%    		channames = channames';%     else%        	channames = fscanf(chid,'%d %f %f  %s',[7 128]);%    		channames = char(channames(4:7,:)');%     end;%     ii = find(channames == '.');%     channames(ii) = ' ';        %channames = channames';    %   [r c] = size(channames);    %for i=1:r    %    for j=1:c    %        if channames(i,j)=='.',    %            channames(i,j)=' ';    %        end;    %    end;    %end;%    end; % setting channames%%%%%%%%%%%%%%%%%%%%%%%%%% Read the color names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  if colors ~=0,    if ~isstr(colors)       fprintf('plotdata(): color file name must be a string.\n');       return    end    cid = fopen(colors,'r');    % fprintf('cid = %d\n',cid);    if cid <3,        fprintf('plotdata: cannot open file %s.\n',colors);        return    end;    colors = fscanf(cid,'%s',[3 Inf]);    colors = colors';       [r c] = size(colors);    for i=1:r        for j=1:c            if colors(i,j)=='.',                colors(i,j)=' ';            end;        end;    end;  else % use default color order (no yellow!)     colors =['r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  ';'r  ';'b  ';'g  ';'c  ';'m  '];     colors = [colors; colors];  % make > 64 available  end;  for c=1:length(colors)   % make white traces black unless axis color is white    if colors(c,1)=='w' & axcolor~=[1 1 1]         colors(c,1)='k';    end  end%%%%%%%%%%%%%%%%%%%%%%%% Read and adjust limits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  if limits==0,      % == 0 or [0 0 0 0]    xmin=0;    xmax=frames-1;    ymin=min(min(data));    ymax=max(max(data));    yrange = ymax-ymin;    ymin = ymin - 0.00*yrange;    ymax = ymax + 0.00*yrange;  else    if length(limits)~=4,      fprintf( ...       'plotdata: limits should be 0 or an array [xmin xmax ymin ymax].\n');      return    end;    xmin = limits(1);    xmax = limits(2);    ymin = limits(3);    ymax = limits(4);  end;  if xmax == 0 & xmin == 0,    x = (0:1:frames-1);

⌨️ 快捷键说明

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