📄 tfrqview.m
字号:
isgrid=isgridsig+2*isgridspe+4*isgridtfr; param = [display,linlog,threshold,levelnumb,Nf2,layout,access,state,fs,isgrid]; map=colormap; if (nargin<=4), tfrview(tfr,sig,t,method,param,map); elseif (nargin==5), tfrview(tfr,sig,t,method,param,map,p1); elseif (nargin==6), tfrview(tfr,sig,t,method,param,map,p1,p2); elseif (nargin==7), tfrview(tfr,sig,t,method,param,map,p1,p2,p3); elseif (nargin==8), tfrview(tfr,sig,t,method,param,map,p1,p2,p3,p4); elseif (nargin==9), tfrview(tfr,sig,t,method,param,map,p1,p2,p3,p4,p5); end; axesh=get(gcf,'UserData'); axcb=axesh(1); axsig=axesh(2); axspec=axesh(3); axtfr=axesh(4); if layout==1, % Time-Frequency Representation axes(axsig); cla reset; set(gca,'Visible','off'); axes(axspec); cla reset; set(gca,'Visible','off'); issig=0; isspec=0; elseif layout==2, % TFR + Signal axes(axspec); cla reset; set(gca,'Visible','off'); issig=1; isspec=0; elseif layout==3, % TFR + spectrum axes(axsig); cla reset; set(gca,'Visible','off'); issig=0; isspec=1; elseif layout==4, % TFR + signal + spectrum issig=1; isspec=1; elseif layout==5, % Colorbar iscolorbar=1-iscolorbar; elseif ((layout==2|layout==3|layout==4) & isempty(sig)), disp('Unallowed action : the signal is anavailable.'); end; lo(indlo)=layout; indlo=indlo+1; end end while (layout==6|layout==5), indlo=indlo-1; if indlo>0, layout=lo(indlo); else layout=layoutold; end end elseif (choice==3), % Change the color map colmap=1; while colmap~=12, colmap=menu('COLOR MAP :',... 'hsv','jet','cool','bone','gray','hot','prism',... 'brighten','darken','permute','spin','Close'); if colmap==1, colormap(hsv); elseif colmap==2, colormap(jet); elseif colmap==3, colormap(cool); elseif colmap==4, colormap(bone); elseif colmap==5, colormap(gray); elseif colmap==6, colormap(hot); elseif colmap==7, colormap(prism); elseif colmap==8, brighten(0.25); elseif colmap==9, brighten(-0.25); elseif colmap==10, c = colormap; colormap(flipud(c)); elseif colmap==11, spinmap; end end elseif (choice==4), % Change the sampling frequency fprintf(' Old sampling frequency: %f',fs); fsold=fs; fs=input(' New sampling frequency: '); if fs==[], fs=fsold; end elseif (choice==5), % Change the threshold fprintf(' Old threshold: %f', threshold); throld=threshold; threshold=input(' New threshold: '); if threshold==[], threshold=throld; end elseif (choice==6), % Change the lin/log scale of tfr linlogtfr=1-linlogtfr; elseif (choice==7), % Change the number of levels fprintf(' Old number of levels: %f',levelnumb); levelold=levelnumb; levelnumb=input(' New number of levels: '); if levelnumb==[], levelnumb=levelold; end elseif (choice==8), % Grids if ~issig & ~isspec, % No signal and no spectrum isgridtfr=1-isgridtfr; axes(axtfr); grid elseif issig & ~isspec, % A signal, no spectrum Grid=1; while Grid~=3, if ~isgridsig, gridsigstr='Add a grid on the signal'; else gridsigstr='Remove the grid on the signal'; end if ~isgridtfr, gridtfrstr='Add a grid on the TFR'; else gridtfrstr='Remove the grid on the TFR'; end Grid=menu('GRID MENU :',gridsigstr,gridtfrstr,'Close'); if Grid==1, isgridsig=1-isgridsig; axes(axsig); grid elseif Grid==2, isgridtfr=1-isgridtfr; axes(axtfr); grid end end elseif ~issig & isspec, % No signal, a spectrum Grid=1; while Grid~=3, if ~isgridspe, gridspestr='Add a grid on the spectrum'; else gridspestr='Remove the grid on the spectrum'; end if ~isgridtfr, gridtfrstr='Add a grid on the TFR'; else gridtfrstr='Remove the grid on the TFR'; end Grid=menu('GRID MENU :',gridspestr,gridtfrstr,'Close'); if Grid==1, isgridspe=1-isgridspe; axes(axspec); grid elseif Grid==2, isgridtfr=1-isgridtfr; axes(axtfr); grid end end else % A signal and a spectrum Grid=1; while Grid~=4, if ~isgridsig, gridsigstr='Add a grid on the signal'; else gridsigstr='Remove the grid on the signal'; end if ~isgridspe, gridspestr='Add a grid on the spectrum'; else gridspestr='Remove the grid on the spectrum'; end if ~isgridtfr, gridtfrstr='Add a grid on the TFR'; else gridtfrstr='Remove the grid on the TFR'; end Grid=menu('GRID MENU :',gridsigstr,gridspestr,gridtfrstr,'Close'); if Grid==1, isgridsig=1-isgridsig; axes(axsig); grid elseif Grid==2, isgridspe=1-isgridspe; axes(axspec); grid elseif Grid==3, isgridtfr=1-isgridtfr; axes(axtfr); grid end end end elseif (choice==9), % Save the parameters f=freq*fs; Nmethod=length(method); if comp(1:2)=='PC', namedflt=[method(4:Nmethod),num2str(Nsig),'.mat']; [name,PathWorkDir] = uiputfile(namedflt, 'Save As'); else namedflt=[method(4:Nmethod),num2str(Nsig)]; nameStr=[' Name of the MAT file [',namedflt,'] : ']; name=input(nameStr,'s'); while (length(name)>8), disp(' The name must have less than 8 characters'); name=input(nameStr,'s'); end if name==[], name=namedflt; end end access=0; linlog=linlogtfr+2*linlogspec; state=issig+2*iscolorbar; isgrid=isgridsig+2*isgridspe+4*isgridtfr; param = [display,linlog,threshold,levelnumb,Nf2,layout,access,state,fs,isgrid]; map=colormap; if (nargin<=4), TfrQView=['tfrqview(tfr,sig,t,method)']; TfrView =['clf;tfrview(tfr,sig,t,method,param,map)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map TfrView TfrQView']); elseif (nargin==5), TfrQView=['tfrqview(tfr,sig,t,method,p1)']; TfrView =['clf; tfrview(tfr,sig,t,method,param,map,p1)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map p1 TfrView TfrQView']); elseif (nargin==6), TfrQView=['tfrqview(tfr,sig,t,method,p1,p2)']; TfrView =['clf; tfrview(tfr,sig,t,method,param,map,p1,p2)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map p1 p2 TfrView TfrQView']); elseif (nargin==7), TfrQView=['tfrqview(tfr,sig,t,method,p1,p2,p3)']; TfrView =['clf; tfrview(tfr,sig,t,method,param,map,p1,p2,p3)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map p1 p2 p3 TfrView TfrQView']); elseif (nargin==8), TfrQView=['tfrqview(tfr,sig,t,method,p1,p2,p3,p4)']; TfrView =['clf; tfrview(tfr,sig,t,method,param,map,p1,p2,p3,p4)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map p1 p2 p3 p4 TfrView TfrQView']); elseif (nargin==9), TfrQView=['tfrqview(tfr,sig,t,method,p1,p2,p3,p4,p5)']; TfrView =['clf; tfrview(tfr,sig,t,method,param,map,p1,p2,p3,p4,p5)']; eval(['save ',PathWorkDir,name,...' tfr sig t f fs method param map p1 p2 p3 p4 p5 TfrView TfrQView']); end; disp(' '); SaveTxt1=[' The file is saved in the directory ',PathWorkDir]; SaveTxt2=[' under the name ',name,'.mat']; disp(SaveTxt1); disp(SaveTxt2); disp(' If you want to find again the exact layout of this screen, do'); Txt1=[' load ',PathWorkDir,name,'; eval(TfrView);']; disp(Txt1); disp(' If you want to restart the display session under tfrqview, do'); Txt2=[' load ',PathWorkDir,name,'; eval(TfrQView);']; disp(Txt2); elseif (choice==10), % Save options save options fs threshold linlogtfr linlogspec levelnumb colmap ... display layout iscolorbar isgridsig ... isgridspe isgridtfr issig isspec; disp(' '); disp(' Options saved'); elseif (choice==11), % Print the current figure Nmethod=length(method); if comp(1:2)=='PC', namedflt=[method(4:Nmethod),num2str(Nsig),'.eps']; [name,PathWorkDir] = uiputfile(namedflt, 'Save As'); else namedflt=[method(4:Nmethod),num2str(Nsig)]; nameStr=[' Name of the EPS file [',namedflt,'] : ']; name=input(nameStr,'s'); while (length(name)>8), disp('The name must have less than 8 characters'); name=input(nameStr,'s'); end if name==[], name=namedflt; end end eval(['print -deps ',PathWorkDir,name]); disp(' '); PrintTxt1=[' The file is saved in the directory ',PathWorkDir]; if comp(1:2)=='PC', PrintTxt2=[' under the name ',name]; else PrintTxt2=[' under the name ',name,'.eps']; end disp(PrintTxt1); disp(PrintTxt2); end; if display~=7, displayold=display; endendif (comp(1:2)~='PC' & exist('workdir.mat')), !rm workdir.matenddisp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -