|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function y = eegplotold(dataname, samplerate, channamefile, titleval, yscaling, range) |
|
|
|
|
|
eval (['global ',dataname]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
icadefs; |
|
|
|
|
|
|
|
|
|
|
|
eval(['DEFAULT_SPACING = max(max(',dataname,''')-min(',dataname,'''));']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_SAMPLERATE = 256; |
|
|
DEFAULT_PLOTTIME = 10; |
|
|
DEFAULT_TITLE = 'eegplotgold()'; |
|
|
errorcode=0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if nargin < 6 |
|
|
PLOT_TIME = DEFAULT_PLOTTIME; |
|
|
else |
|
|
PLOT_TIME = range; |
|
|
end |
|
|
if nargin < 5 |
|
|
spacing_var = DEFAULT_SPACING; |
|
|
else |
|
|
spacing_var = yscaling; |
|
|
end |
|
|
if spacing_var == 0 |
|
|
spacing_var = DEFAULT_SPACING; |
|
|
end |
|
|
|
|
|
if nargin < 4 |
|
|
titleval = DEFAULT_TITLE; |
|
|
end |
|
|
if titleval == 0 |
|
|
titleval = DEFAULT_TITLE; |
|
|
end |
|
|
if nargin < 3 |
|
|
channamefile = 0; |
|
|
end |
|
|
if nargin < 2 |
|
|
samplerate = DEFAULT_SAMPLERATE; |
|
|
end |
|
|
if samplerate == 0, |
|
|
samplerate = DEFAULT_SAMPLERATE; |
|
|
end; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE_RATE = samplerate; |
|
|
time = 0; |
|
|
eval(['[chans,frames] = size(',dataname,');']) |
|
|
|
|
|
maxtime = frames / samplerate; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if channamefile ~=0, |
|
|
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; |
|
|
|
|
|
icadefs; |
|
|
if errorcode==0, |
|
|
channames = fscanf(chid,'%s',[6 MAXEEGPLOTCHANS]); |
|
|
channames = channames'; |
|
|
[r c] = size(channames); |
|
|
for i=1:r |
|
|
for j=1:c |
|
|
if channames(i,j)=='.', |
|
|
channames(i,j)=' '; |
|
|
end; |
|
|
end; |
|
|
end; |
|
|
% fprintf(' |
|
|
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, |
|
|
channames = []; |
|
|
for c=1:chans |
|
|
if c<10, |
|
|
numeric = [' ' int2str(c)]; |
|
|
else |
|
|
numeric = [' ' int2str(c)]; |
|
|
end |
|
|
channames = [channames;numeric]; |
|
|
end; |
|
|
end; |
|
|
|
|
|
channames = str2mat(channames, ' '); |
|
|
|
|
|
|
|
|
Xlab = num2str(time); |
|
|
for j = 1:1:PLOT_TIME |
|
|
Q = num2str(time+j); |
|
|
Xlab = str2mat(Xlab, Q); |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
figure; |
|
|
fighandle = gcf; |
|
|
orient landscape |
|
|
hold on; |
|
|
set(gcf,'NumberTitle','off') |
|
|
if VERS >= 8.04 |
|
|
set(gcf,'Name',['EEGPLOTOLD #',num2str(fighandle.Number)]); |
|
|
else |
|
|
set(gcf,'Name',['EEGPLOTOLD #',num2str(gcf)]); |
|
|
end |
|
|
set (gca, 'xgrid', 'on') |
|
|
set (gca, 'GridLineStyle','-') |
|
|
set (gca, 'XTickLabels', Xlab) |
|
|
set (gca, 'Box', 'on') |
|
|
set (gca, 'XTick', time*samplerate:1.0*samplerate:PLOT_TIME*samplerate) |
|
|
set (gca, 'Ytick', 0:spacing_var:chans*spacing_var) |
|
|
set (gca, 'TickLength', [0.001 0.001]) |
|
|
title(titleval) |
|
|
axis([0 PLOT_TIME*samplerate 0 (chans+1)*spacing_var]); |
|
|
set (gca, 'YTickLabels', flipud(channames)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1:chans |
|
|
if (maxtime-time>PLOT_TIME) |
|
|
eval(['F = ',dataname,'(chans-i+1,(time*samplerate)+1:(time+PLOT_TIME*samplerate));']) |
|
|
else |
|
|
eval(['F = ',dataname,'(chans-i+1,(time*samplerate)+1:(maxtime*samplerate));']) |
|
|
end |
|
|
F = F - mean(F) + i*spacing_var; |
|
|
plot (F,'clipping','off') |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line([(PLOT_TIME+.3)*samplerate,(PLOT_TIME+.3)*samplerate],[1.5*spacing_var 2.5*spacing_var],'clipping','off','color','w') |
|
|
line([(PLOT_TIME+.3)*samplerate-10,(PLOT_TIME+.3)*samplerate+10],[2.5*spacing_var,2.5*spacing_var],'clipping','off','color','w') |
|
|
line([(PLOT_TIME+.3)*samplerate-10,(PLOT_TIME+.3)*samplerate+10],[1.5*spacing_var,1.5*spacing_var],'clipping','off','color','w') |
|
|
text((PLOT_TIME+.5)*samplerate,2*spacing_var,num2str(round(spacing_var)),'clipping','off') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slider_position = [.125 .030 .3 .024]; |
|
|
edit_position = [.65 .025 .1 .05]; |
|
|
slider_position2 = [.8 .03 .1 .024]; |
|
|
b1_position = [.175 .022 .09 .047]; |
|
|
b2_position = [.29 .022 .09 .047]; |
|
|
b3_position = [.125 .022 .045 .047]; |
|
|
b4_position = [.385 .022 .045 .047]; |
|
|
|
|
|
Max_Space = 1; |
|
|
Min_Space = DEFAULT_SPACING*2; |
|
|
|
|
|
|
|
|
axhandle = gca; |
|
|
User_Data_Mat(1) = samplerate; |
|
|
User_Data_Mat(2) = PLOT_TIME; |
|
|
User_Data_Mat(3) = spacing_var; |
|
|
User_Data_Mat(4) = time; |
|
|
User_Data_Mat(5) = maxtime; |
|
|
User_Data_Mat(6) = axhandle; |
|
|
User_Data_Mat(7) = 1; |
|
|
User_Data_Mat(8) = frames; |
|
|
User_Data_Mat(9) = chans; |
|
|
User_Data_Mat(12) = 1; |
|
|
|
|
|
tstring1 = 'data1973 = get(gcf,''UserData'');'; |
|
|
tstring2 = 'set(gcf,''UserData'',data1973);'; |
|
|
tstring3 = 'eegdrawgv(gcf);'; |
|
|
|
|
|
TIMESTRING = [tstring1,'if (data1973(4)-data1973(2))<0;','data1973(4) = 0;','else;','data1973(4) = data1973(4) - data1973(2);','end;',tstring2,tstring3,'clear data1973']; |
|
|
|
|
|
hb = uicontrol('Style','PushButton','Units','Normalized','position',b1_position,'String','PREV','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'if (data1973(4)+data1973(2))>=data1973(5);','data1973(4)=data1973(4);','else;','data1973(4) = data1973(4) + data1973(2);','end;',tstring2,tstring3,'clear data1973']; |
|
|
|
|
|
hf = uicontrol('Style','PushButton','Units','Normalized','position',b2_position,'String','NEXT','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'if (data1973(4)-1)<0;','data1973(4) = 0;','else;','data1973(4) = data1973(4) - 1;','end;',tstring2,tstring3,'clear data1973']; |
|
|
|
|
|
hbos = uicontrol('Style','PushButton','Units','Normalized','position',b3_position,'String','<<','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'if (data1973(4)+1)>=data1973(5);','data1973(4)=data1973(4);','else;','data1973(4) = data1973(4) + 1;','end;',tstring2,tstring3,'clear data1973']; |
|
|
|
|
|
hfos = uicontrol('Style','PushButton','Units','Normalized','position',b4_position,'String','>>','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'time1973 = get(gco,''string'');','time1973 = str2num(time1973);','data1973(4) = time1973;',tstring2,tstring3,'clear time1973 data1973']; |
|
|
|
|
|
w=uicontrol('style','edit','units','normalized','HorizontalAlignment','left','position',edit_position,'UserData',axhandle,'callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'data1973(3) = get(gco,''value'');',tstring2,tstring3,'clear time1973 data1973']; |
|
|
|
|
|
u=uicontrol('style','slider','units','normalized','position',slider_position2,'Max',Max_Space,'Min',Min_Space,'value',spacing_var,'UserData',axhandle,'callback',TIMESTRING); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TIMESTRING = ['fighand1973 = gcf;','delete(fighand1973);','clear fighand1973;']; |
|
|
|
|
|
fm1 = uimenu('Label','Window'); |
|
|
fm2 = uimenu(fm1,'Label','Close ','UserData',fighandle,'Callback',TIMESTRING); |
|
|
|
|
|
|
|
|
|
|
|
TIMESTRING = [tstring1,'out1973 = gettext(''Input new windowlength(sec).'');','if isempty(out1973);','out1973 = 0;','else;','data1973(2) = str2num(out1973);',tstring2,tstring3,'end;','clear data1973 out1973']; |
|
|
|
|
|
dm1 = uimenu('Label','Display'); |
|
|
dm2 = uimenu(dm1,'Label',' Window Length','Interruptible','on','Callback',TIMESTRING); |
|
|
dm3 = uimenu(dm1,'Label',' Color'); |
|
|
|
|
|
TIMESTRING = [tstring1,'data1973(7) = 1;',tstring2,tstring3,'clear data1973;']; |
|
|
|
|
|
dm4 = uimenu(dm3,'Label','Yellow ','UserData',axhandle,'Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'data1973(7) = 2;',tstring2,tstring3,'clear data1973;']; |
|
|
|
|
|
dm5 = uimenu(dm3,'Label','White ','UserData',axhandle,'Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = ['label1973 = gettext(''Enter new title.'');','if isempty(label1973);','label1973 = 0;','else;','title(label1973);','end;','clear label1973;']; |
|
|
|
|
|
dm6 = uimenu(dm1,'Label','Title ','Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'Check1973 = get(data1973(10),''checked'');','if (Check1973(1:2) == ''on'');','set(data1973(10),''Checked'',''off'');','set(data1973(6),''XGrid'',''off'');','else;','set(data1973(10),''Checked'',''on'');','set(data1973(6),''XGrid'',''on'');','end;','clear data1973 Check1973;']; |
|
|
|
|
|
dm7 = uimenu(dm1,'Label','Grid','Checked','on','Callback',TIMESTRING); |
|
|
|
|
|
User_Data_Mat(10) = dm7; |
|
|
|
|
|
TIMESTRING = [tstring1,'Check1973 = get(data1973(11),''checked'');','if (Check1973(1:2) == ''on'');','set(data1973(11),''Checked'',''off'');','data1973(12)= 0;','else;','set(data1973(11),''Checked'',''on'');','data1973(12) = 1;','end;',tstring2,tstring3,'clear data1973 Check1973;']; |
|
|
|
|
|
dm8 = uimenu(dm1,'Label','Scaling I','Checked','on','Callback',TIMESTRING); |
|
|
|
|
|
User_Data_Mat(11) = dm8; |
|
|
|
|
|
|
|
|
|
|
|
sm1 = uimenu('Label','Settings'); |
|
|
|
|
|
TIMESTRING = [tstring1,'Srate1973 = gettext(''Enter new samplerate'');','if isempty(Srate1973);','Srate1973 = 0;','else;','data1973(1) = str2num(Srate1973);','data1973(5) = data1973(8)/data1973(1);','data1973(4) = 0;',tstring2,tstring3,'end;','clear Srate1973 data1973']; |
|
|
|
|
|
sm2 = uimenu(sm1,'Label','Samplerate','Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
|
|
|
|
|
|
em1 = uimenu('Label','Electrodes'); |
|
|
|
|
|
TIMESTRING = [tstring1,'ChanNamefile1973 = gettext(''Enter Electrode file to load.'');','if isempty(ChanNamefile1973);','ChanNamefile1973=0;','else;','ChanNames1973 = loadelec(ChanNamefile1973);','set(data1973(6),''YTickLabels'',flipud(ChanNames1973));','end;','clear data1973 ChanNamefile1973 ChanNames1973']; |
|
|
|
|
|
em2 = uimenu(em1,'Label','Load Electrode File ','Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
TIMESTRING = [tstring1,'ChanNames1973 = makeelec(data1973(9));','if isempty(ChanNames1973);','ChanNames1973=0;','else;','set(data1973(6),''YTickLabels'',flipud(ChanNames1973));','end;','clear data1973 ChanNames1973']; |
|
|
|
|
|
em3 = uimenu(em1,'Label','Make Electrode File ','Interruptible','on','Callback',TIMESTRING); |
|
|
|
|
|
set(axhandle,'UserData',dataname) |
|
|
set(fighandle,'UserData',User_Data_Mat) |
|
|
|