Professional Documents
Culture Documents
Function: 'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'
Function: 'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = INSS_GUI_V4final_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%g="bheregwyy"
guidata(hObject,handles)
file_dir=handles.path;
KKK=split(file_dir,["\"]);
kkkk=split(KKK{end},["b"]);
kk=split(kkkk{2},["_"]);
Subj=str2num(kk{1});
kkx=split(kk(2),["."]);
File=str2num(kkx{1});
sb=num2str(Subj);
fi=num2str(File);
try
load(['D:\INSS_GUI_V4\Marked Labels\' sb '_' fi '.mat']);
handles.Marked_Labels=Marked_Labels;
asx=['File already processed'];
set(handles.edit3,'String',asx);
channelNumber=1;
%blah=get(gcf,'CurrentAxes')
plotClassifiedProfileBox(handles,channelNumber)
%ax1=get(gcf,'CurrentAxes')
catch
asx=['File is not processed yet'];
handles.Marked_Labels=[];
set(handles.edit3,'String',asx);
end
fwrite(fopen([pwd '\lastVisitedAddress.txt'],
'w'),get(handles.edit1,'String'));
fwrite(fopen([ pwd '\lastSamplingFrequency.txt'],
'w'),get(handles.edit2,'String'));
asx=['Zoom Count'];
set(handles.edit4,'String',asx);
handles.flg=0;
handles.cnt=0;
handles.x=[];
handles.pluss=[];
handles.Marked_Labels=[];
guidata(hObject,handles)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55555
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pop_comments(handles, comments);
%}
channelNumber=handles.channelNumber;
Chan=channelNumber;
PathName=handles.pathname;
mbhandles =
msgbox('Processing............................................','Load');
%
[V,S_T,S_P,Accuracy]=Process_Test(data(channelNumber,:),Subj,File,channelNumbe
r);
%
[V,S_T,S_P,Accuracy]=Process_Test_Balanced(data(channelNumber,:),Subj,File,cha
nnelNumber,PathName);
hdr=handles.hdr;
[V,S_T,S_P,Accuracy]=Process(data,Subj,File,Chan,PathName,hdr);
% global S_P
% Accuracy
mbhandles = msgbox('Processing
completed............................................','Load');
msgbox('Function passed')
xxx=0;yyy=0;
for i=1:length(S_T)
if S_T(i)==1
xxx=xxx+1;
if S_P(i)==1
yyy=yyy+1;
end
end
end
handles.S_T=S_T;
handles.S_P=S_P;
handles.Marked_Labels=[];
guidata(hObject,handles)
handles.flg=0;
plotClassifiedProfileBox(handles,channelNumber)
msgbox('Plot passed')
mbhandles = msgbox('Plot
Passed............................................','Load');
Label=handles.S_P;
tt=sum(Label);
asx=['Total' ' ' num2str(tt) ' ' ' Seizures Found'];
set(handles.edit2,'String',asx);
delete(mbhandles)
asx=['Zoom Count'];
set(handles.edit4,'String',asx);
handles.pluss=[];
handles.cnt=0;
guidata(hObject,handles)
%{
function plotSummaryBox(handles,channelNumber)
data=handles.data;
temp = data(channelNumber,:);
sampels = length(temp);
cla(handles.axes3)
plot(handles.axes3,temp)
if handles.flg==0
Group=S_P;
else
x=handles.x;
Group=S_P(x(1):x(2),:);
% temp = data(channelNumber,x(1):x(2));
i1=x(1);i2=x(2);
end
j=1;
cla(handles.axes4)
sampFreq=256;
hold(handles.axes4,'on')%%%%%%%%%% process
for i=1:length(Group)
if handles.flg==0
if Group(j)==0
plot(handles.axes4,((i-1)*sampFreq+1:i*sampFreq)/sampFreq,temp(1,(i-
1)*sampFreq+1:i*sampFreq),'b')
else
plot(handles.axes4,((i-1)*sampFreq+1:i*sampFreq)/sampFreq,temp(1,(i-
1)*sampFreq+1:i*sampFreq),'r')
end
j=j+1;
else
if Group(j)==0
plot(handles.axes4,((i1-1)*sampFreq+1:i1*sampFreq)/sampFreq,temp(1,
(i1-1)*sampFreq+1:i1*sampFreq),'b')
else
plot(handles.axes4,((i1-1)*sampFreq+1:i1*sampFreq)/sampFreq,temp(1,
(i1-1)*sampFreq+1:i1*sampFreq),'r')
end
j=j+1;i1=i1+1;
end
end
if handles.flg==0
xlim(handles.axes4,[0 length(Group)])
else
xlim(handles.axes4,[x(1) x(2)])
end
hold(handles.axes4,'off')
title(handles.axes4,'Processed data','FontSize', 15);
xlabel(handles.axes4,'Epochs (Sec)')
ylabel(handles.axes4,'V (\mu v)')
x=floor(x);
y=floor(y);
% handles.x=x;
% handles.y=y;
if x(1)<x(2)
xa=x(1);xb=x(2);
else
xa=x(2);xb=x(1);
end
Marked_Labels=handles.Marked_Labels;
if isempty(Marked_Labels)
Labels=handles.S_P;
Marked_Labels=Labels;
Marked_Labels(xa:xb,:)=1;
else
Marked_Labels(xa:xb,:)=1;
end
handles.Marked_Labels=Marked_Labels;
channelNumber=handles.channelNumber;
plotClassifiedProfileBox(handles,channelNumber)
guidata(hObject,handles)
[x,y] = ginput(2)
x=floor(x);
y=floor(y);
if x(1)<x(2)
xa=x(1);xb=x(2);
else
xa=x(2);xb=x(1);
end
if isempty(handles.Marked_Labels)
Labels=S_P;
Labels(xa:xb,:)=0;
Marked_Labels=Labels;
else
Marked_Labels(xa:xb,:)=0;
end
handles.Marked_Labels=Marked_Labels;
channelNumber=handles.channelNumber;
plotClassifiedProfileBox(handles,channelNumber)
guidata(hObject,handles)
myfile1=num2str(handles.File);
myfile2=num2str(handles.Subj);
myfile=[myfile2 '_' myfile1];
x=handles.x;
% y=handles.y;
Marked_Labels=handles.Marked_Labels;
save(['D:\INSS_GUI_V4\Marked Labels/' myfile '.mat'],'x','Marked_Labels')
% S_P=handles.S_P;
% data=handles.data;
% hdrnew=handles.hdr;
% hdr=handles.hdr;
% hdrnew.channels=hdr.label;
% hdrnew.samplingrate=256;
% hdrnew.markk=S_P;
% % hdrnew.units=S_P;
% lab_write_edf('newedfsaveee',data,hdrnew);
mbhandles=msgbox('Save Complete','Load','modal');
delete(mbhandles)
guidata(hObject,handles)
asx=[num2str(cnt)];
set(handles.edit4,'String',asx);
pluss=handles.pluss;
pluss(cnt).x=x;
handles.cnt=cnt;
handles.pluss=pluss;
channelNumber=handles.channelNumber;
plotClassifiedProfileBox(handles,channelNumber)
guidata(hObject,handles)
channelNumber=handles.channelNumber;
pluss=handles.pluss;
p=length(pluss);
if p<=1
handles.flg=0;
plotClassifiedProfileBox(handles,channelNumber)
else
handles.flg=1;
x=pluss(p-1).x;
p=p-1;
for i=1:p
pp(i).x=pluss(i).x;
end
pluss=pp;
handles.pluss=pluss;
handles.x=x;
plotClassifiedProfileBox(handles,channelNumber)
end
guidata(hObject,handles)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define defaults
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%{
icadefs; % read MAXEEGPLOTCHANS, DEFAULT_SRATE, DEFAULT_EPOCH from icadefs.m
if nargin < 1
help eegplots % print usage message
PLOT_TIME = 10;
data = 0.5*randn(8,floor(DEFAULT_SRATE*PLOT_TIME*2));
titleval = ['eegplots() example - random noise']; % show example plot
end
%}
[chans,frames] = size(data); %size of data matrix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Allow for different numbers of arguments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin < 9,
vertmark = 0;
end
if nargin < 8,
xstart = 0;
end
if nargin < 7
linecolor = 'y'; % DEFAULT LINECOLOR
end
if linecolor == 0,
linecolor = 'y'; % DEFAULT LINECOLOR
end
if nargin < 6
PLOT_TIME = 0;
else
PLOT_TIME = epoch;
end
if nargin < 5
spacing_var = 0;
else
spacing_var = yscaling;
end
if spacing_var == 0
spacing_var = DEFAULT_SPACING;
end
if nargin < 4
titleval = DEFAULT_TITLE;
end
if ~isstr(titleval)
if titleval == 0
titleval = DEFAULT_TITLE;
else
help eegplots
return
end
end
if nargin < 3
channamefile = 0;
end
if nargin < 2
srate = DEFAULT_SRATE;
end
if srate == 0,
srate = DEFAULT_SRATE;
end;
if PLOT_TIME == 0
PLOT_TIME = ceil(frames/srate);
if PLOT_TIME > DEFAULT_EPOCH
PLOT_TIME = DEFAULT_EPOCH;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define internal variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read the channel names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%{
if channamefile ~=0, % read file of channel names
chid = fopen(channamefile,'r');
if chid <3,
fprintf('_plotdata: cannot open file %s.\n',channamefile);
errorcode=2;
channamefile = 0;
else
% fprintf('Chan info file %s opened\n',channamefile);
end;
if errorcode==0,
channames = fscanf(chid,'%d %f %f %s',[7 MAXEEGPLOTCHANS]);
channames = channames';
channames = setstr(channames(:,4:7)); % convert ints to chars
[r c] = size(channames);
for i=1:r
for j=1:c
if channames(i,j)=='.',
channames(i,j)=' '; % convert dots to spaces
end;
end;
end;
% fprintf('%d channel names read from file.\n',r);
if (r>chans)
fprintf('Using first %d names.\n',chans);
channames = channames(1:chans,:);
end;
if (r<chans)
fprintf('Only %d channel names read.\n',r);
end;
end;
end
%}
if channamefile ==0, % plot channel numbers
channames = [];
for c=1:chans
if c<10,
numeric = [' ' int2str(c)]; % four-character fields
else
numeric = [' ' int2str(c)];
end
channames = [channames;numeric];
end;
end; % setting channames
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make matrix of x-tick labels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xlab = num2str(0);
%for j = 1:1:PLOT_TIME
% Q = num2str(0+j);
% Xlab = str2mat(Xlab, Q);
%end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set Graph Characteristics
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
hold( handles.axes3, 'on' );
%get(handles.axes4, 'xgrid', 'on')
cla(handles.axes3)
%orange=get(gcf,'CurrentAxes')%making a new matlab axis useless!
set (handles.axes3, 'xgrid', 'on') % Xaxis gridlines only
set (handles.axes3, 'GridLineStyle','-') % Solid grid lines
% set (gca, 'XTickLabel', Xlab) % Use Xlab for tick labels
%set (gca, 'XTick', 0*srate:1.0*srate:PLOT_TIME*srate)
set (handles.axes3, 'Box', 'on')
set (handles.axes3, 'Ytick', 0:spacing_var:chans*spacing_var) % ytick
spacing on channels
set (handles.axes3, 'TickLength', [0.02 0.02])
title(handles.axes3,titleval) % title is
titleval
axis([xstart xstart+PLOT_TIME 0 (chans+1)*spacing_var]);
set (handles.axes3, 'YTickLabels', flipud(channames),'FontSize',9) % write
channel names
% Matlab-5 requires YTickLabels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot the EEG data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% lastn=919040
%data = data(1:end-lastn,:);
refax=handles.axes3;
PLOT_TIME=3600;
xx = xstart:1/srate:xstart+PLOT_TIME-0.9/srate; % x-range values
% xx
% xx = xx(:,1:2560);% looks like the range again
for i = 1:chans
F = data(chans-i+1,:);% extracts the specific row with all columns
F = F - mean(F) + i*spacing_var; % add offset to y-values
ploh= plot(handles.axes3, xx,F);
end
hold(handles.axes3, 'off');
%clear xx F
%arbitrarily set the reference axes limits to small portion of the
%total X/Y data of the plot handle.
set(refax,'xlim',[0 80]);
%make an X axis and Y axis scroll bar
axeslist = {'X'};
superscroll_obj=superscroll(refax,axeslist);
%build scrollbar, add keypress and resize functions
autoscrollbar(superscroll_obj,ploh);
%make one scroll bar yellow
yellow(superscroll_obj.axdyn(1));
%title(refax,'pan and zoom using arrow keys, shift and control')
%{
if xstart<0 & xstart+PLOT_TIME > 0
linetime = round(-xstart/srate);
line ([linetime linetime],[1e10,-1e10]);
end
if vertmark ~= 0,
for mark = vertmark,
linetime = xstart + (mark-1)/srate;
line ([linetime linetime],[-1e10,1e10],'Color','y','LineStyle',':');
end
end
%}
%{
function fazul(handles)
hold( handles.axes3, 'on' )
x=0:1:10;
y=2:1:12;
ploth=plot(x,y)
ploh=plot(x,y,'-*r','linewidth',2,'parent',refax); clear x y
set(refax,'xlim',[0 80],'ylim',[-1 2]);
axeslist = {'X','Y'};
superscroll_obj=superscroll(refax,axeslist);
EEG.setname = '';
EEG.filename = '';
EEG.filepath = '';
EEG.pnts = 0;
EEG.nbchan = 0;
EEG.trials = 0;
EEG.srate = 1;
EEG.xmin = 0;
EEG.xmax = 0;
EEG.rt = [];
EEG.data = [];
EEG.icawinv = [];
EEG.icasphere = [];
EEG.icaweights = [];
EEG.icaact = [];
EEG.event = [];
EEG.epoch = [];
EEG.chanlocs = '';
EEG.comments = 'Patient Comments';
%EEG.reject.threshold = [1 0.8 0.85];
%EEG.reject.icareject = [];
%EEG.reject.compreject = [];
%EEG.reject.gcompreject= [];
%EEG.reject.comptrial = [];
%EEG.reject.sigreject = [];
%EEG.reject.elecreject = [];
%EEG.stats.kurta = [];
%EEG.stats.kurtr = [];
%EEG.stats.kurtd = [];
%EEG.stats.eegentropy = [];
%EEG.stats.eegkurt = [];
%EEG.stats.eegkurtg = [];
%EEG.stats.entropy = [];
%EEG.stats.kurtc = [];
%EEG.stats.kurtt = [];
%EEG.stats.entropyc = [];
return;
com = '';
if nargin < 1
help pop_comments;
return;
end;
%if nargin < 2
%figure('menubar', 'none', 'numbertitle', 'off', 'name', 'About this
dataset -- pop_comment()');
axes(handles.axes5);
pos = get(handles.axes5,'position'); % plot relative to current axes
q = [pos(1) pos(2) 0 0];
s = [pos(3) pos(4) pos(3) pos(4)]./100;
set(handles.axes5, 'userdata', 0);
title('Comments on current dataset');
axis off;
hh = uicontrol('Parent',gcf, ...
'Units','Normalized', ...
'style', 'edit', ...
'tag', 'edit', ...
'Position', [0 15 100 85].*s+q, ...
'string', comments, ...
'backgroundcolor', [ 1 1 1], ...
'horizontalalignment', 'left', ...
'max', 2, ...
'fontsize', 12);
waitfor(gcf, 'userdata');
if isstr(get(gcf, 'userdata'))
comments = get(gcf, 'userdata') % ok button
%fwrite(fopen([ pwd '\comms.txt'], 'w'),get(handles.axes5,'edit'));
end;
%close(gcf);
%else
%try, comments = char(eval(comments)); catch, end;
%end;
EEG.comments = comments;
fileID = fopen('Patient.txt','w');
%fprintf(fileID,'%6s %12s\n','x','exp(x)');
fprintf(fileID,comments);
fclose(fileID);
if nargin<5
help spectopo
return
end
if nargin<8
freqfac = FREQFAC;
end
if nargin<7
titl = []; % default no title
end
if nargin<6
limits = [nan nan nan nan nan nan]; % defaults from data
end
if nargin<9
percent = 1; % defaults sample 100% of the data
else
percent = max(percent, 0);
percent = min(percent, 1);
end
if frames == 0
frames = size(data,2); % assume one epoch
end
if min(headfreqs)<0
fprintf('spectopo(): freqs must be >=0 Hz\n');
return
end
nchans = size(data,1);
epochs = round(size(data,2)/frames);
if frames*epochs ~= size(data,2)
error('Spectopo: non-integer number of epochs');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute channel spectra using psd()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
epoch_subset = 1:epochs;
if percent ~= 1 & epochs > 1
nb = round( percent*epochs);
epoch_subset = zeros(1,epochs);
while nb>0
index = ceil(rand*epochs);
if ~epoch_subset(index)
epoch_subset(index) = 1;
nb = nb-1;
end;
end;
epoch_subset = find(epoch_subset == 1);
fprintf('Selecting randomly %d epochs\n', length(epoch_subset));
end;
fftlength = 2^round(log(srate)/log(2))*FREQFAC;
fprintf('Computing spectra: ')
for c=1:nchans
for e=epoch_subset
[tmpspec,freqs] = pwelch(matsel(data,frames,0,c,e),fftlength,...
srate,fftlength/2,fftlength/8);
if c==1 & e==epoch_subset(1)
eegspec = zeros(nchans,length(freqs));
end
eegspec(c,:) = eegspec(c,:) + tmpspec';
end
fprintf('.')
end
eegspecdB = 10*log10(eegspec/epochs); % convert power to dB
fprintf('\n')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute axis and caxis limits
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if length(limits)<1 | isnan(limits(1))
limits(1) = LOPLOTHZ;
end
if length(limits)<2 | isnan(limits(2))
maxheadfreq = max(headfreqs);
if rem(maxheadfreq,5) ~= 0
limits(2) = 5*ceil(maxheadfreq/5);
else
limits(2) = maxheadfreq*1.1;
end
end
if length(limits)<3|isnan(limits(3))
limits(3) = min(min(eegspecdB(:,minfreqidx:maxfreqidx)));
end
if length(limits)<4|isnan(limits(4))
limits(4) = max(max(eegspecdB(:,minfreqidx:maxfreqidx)));
end
dBrange = limits(4)-limits(3); % expand range a bit beyond data limits
limits(3) = limits(3)-dBrange/7;
limits(4) = limits(4)+dBrange/7;
if isnan(limits(5))+isnan(limits(6)) == 1
fprintf('spectopo(): limits 5 and 6 must either be given or nan\n');
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot spectrum of each channel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
specaxes = sbplot(3,4,[5 12]);
% plot(freqs(1:maxfreqidx),eegspecdB(:,1:maxfreqidx)','b','LineWidth',2);
pl=plot(freqs(1:maxfreqidx),eegspecdB(:,1:maxfreqidx)');
set(pl,'LineWidth',2);
set(gca,'TickLength',[0.02 0.02]);
xl=xlabel('Frequency (Hz)');
set(xl,'fontsize',16);
yl=ylabel('Rel. Power (dB)');
set(yl,'fontsize',16);
set(gca,'fontsize',16)
box off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot lines through channel trace bundle at each headfreq
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for f=1:length(headfreqs)
hold on;
plot([freqs(freqidx(f)) freqs(freqidx(f))], ...
[min(eegspecdB(:,freqidx(f))) max(eegspecdB(:,freqidx(f)))],...
'k','LineWidth',2.5);
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot connecting lines using changeunits()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
headax = zeros(1,length(headfreqs));
for f=1:length(headfreqs)
headax(f) = sbplot(3,length(headfreqs),f);
axis([-1 1 -1 1]);
end
large = sbplot(1,1,1);
for f=1:length(headfreqs)
from = changeunits([freqs(freqidx(f)),max(eegspecdB(:,freqidx(f)))],...
specaxes,large);
to = changeunits([0,0],headax(f),large);
hold on;
plot([from(1) to(1)],[from(2) to(2)],'k','LineWidth',2);
axis([0 1 0 1]);
axis off;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot heads using topoplot()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fprintf('Plotting scalp distributions: ')
chanlocs= 'chalocfile.loc';
for f=1:length(headfreqs)
axes(headax(f));
topodata = eegspecdB(:,freqidx(f))-mean(eegspecdB(:,freqidx(f)));
if isnan(limits(5)), maplimits = 'absmax';
else maplimits = [limits(5) limits(6)];
end;
if ~isempty(varargin)
topoplot(topodata,chanlocs,'maplimits',maplimits, varargin{:});
else
topoplot(topodata,chanlocs,'maplimits',maplimits);
end
if f<length(headfreqs)
tl=title([num2str(freqs(freqidx(f)), '%3.1f')]);
else
tl=title([num2str(freqs(freqidx(f)), '%3.1f') ' Hz']);
end
set(tl,'fontsize',16);
axis square;
drawnow
fprintf('.');
end;
fprintf('\n');
%%%%%%%%%%%%%%%%
% Plot color bar
%%%%%%%%%%%%%%%%
cb=colorbar;
pos = get(cb,'position');
set(cb,'position',[pos(1) pos(2) 0.03 pos(4)]);
set(cb,'fontsize',12);
if isnan(limits(5))
ticks = get(cb,'ytick');
[tmp zi] = find(ticks == 0);
ticks = [ticks(1) ticks(zi) ticks(end)];
% set(cb,'ytick',ticks);
set(cb,'yticklabel',{'-','0','+'});
end
%%%%%%%%%%%%%%%%
% Draw title
%%%%%%%%%%%%%%%%
if ~isempty(titl)
tl = textsc(titl,'title');
set(tl,'fontsize',15)
end
%%%%%%%%%%%%%%%%
% Turn on axcopy
%%%%%%%%%%%%%%%%
axcopy
hndl= findobj('parent',fig,'type','axes');
offidx=[];
for a=1:length(hndl) % make all axes visible
if exist('command') ~= 1
set(findobj('parent',hndl(a)),'ButtonDownFcn','copyaxis');
else
set(findobj('parent',hndl(a)),'ButtonDownFcn',['copyaxis(''' command
''')']);
end;
end
figure(fig);
if exist('command') ~= 1
set(hndl(a),'ButtonDownFcn','copyaxis');
else
set(hndl,'ButtonDownFcn',['copyaxis(''' command ''')']);
end;