📄 tfrqview.m
字号:
layout=1; if issig==0, SignalStr= 'display signal'; else SignalStr='remove signal'; end; if isspec==0, SpectrumStr= 'display spectrum'; else SpectrumStr='remove spectrum'; end; if ~issig & ~isspec, if isgridtfr, GridStr='Remove the grid'; else GridStr='Add a grid'; end; else GridStr='Grids'; end; if iscolorbar==0, ColorbarStr='display colorbar'; else ColorbarStr='remove colorbar'; end; layout=menu('DISPLAY LAYOUT',... SignalStr,... SpectrumStr,... GridStr,... ColorbarStr,... 'cancel'); if layout==1, issig=~issig; if issig==1, if isempty(sig), disp('Impossible action : the signal is unavailable'); issig=0; CallTfrView=0; else sigenveloppe=menu('SIGNAL REPRESENTATION','signal only','signal with enveloppe')-1; CallTfrView=1; end; else isgridsig=0; end; elseif layout==2, isspec=~isspec; if isspec==1, if isempty(sig), disp('Impossible action : the signal is unavailable'); isspec=0; CallTfrView=0; else linlogspec=menu('FREQUENCY REPRESENTATION','linear scale','log scale')-1; CallTfrView=1; end; else isgridspec=0; end; elseif layout==3, if ~issig & ~isspec, % No signal and no spectrum isgridtfr=1-isgridtfr; CallTfrView=1; elseif issig & ~isspec, % A signal, no spectrum Grid=1; 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,'cancel'); if Grid==1, isgridsig=1-isgridsig; CallTfrView=1; elseif Grid==2, isgridtfr=1-isgridtfr; CallTfrView=1; else CallTfrView=0; end elseif ~issig & isspec, % No signal, a spectrum Grid=1; if ~isgridspec, 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, isgridspec=1-isgridspec; CallTfrView=1; elseif Grid==2, isgridtfr=1-isgridtfr; CallTfrView=1; else CallTfrView=0; end else % A signal and a spectrum Grid=1; if ~isgridsig, gridsigstr='add a grid on the signal'; else gridsigstr='remove the grid on the signal'; end if ~isgridspec, 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,'cancel'); if Grid==1, isgridsig=1-isgridsig; CallTfrView=1; elseif Grid==2, isgridspec=1-isgridspec; CallTfrView=1; elseif Grid==3, isgridtfr=1-isgridtfr; CallTfrView=1; else CallTfrView=0; end end elseif layout==4, iscolorbar=~iscolorbar; CallTfrView=1; elseif layout==5, CallTfrView=0; end; elseif (choice==ChoiceSampling), % Change the sampling frequency fprintf(' Old sampling frequency: %f\n',fs); fsold=fs; fs=input(' New sampling frequency: '); if isempty(fs), fs=fsold; CallTfrView=0; else CallTfrView=1; end; elseif (choice==ChoiceFreqBounds), % Change the frequency bounds CallTfrView=0; fprintf(' Old smallest normalized frequency : %f\n',fmin); fminold=fmin; fmin=input(' New smallest normalized frequency : '); if isempty(fmin), fmin=fminold; elseif fmin>0.5, fprintf('normalized frequency desired ! value unmodified\n'); fmin=fminold; else CallTfrView=1; end; fprintf(' Old highest normalized frequency : %f\n',fmax); fmaxold=fmax; fmax=input(' New highest normalized frequency : '); if isempty(fmax), fmax=fmaxold; elseif fmax>0.5, fprintf('normalized frequency desired ! value unmodified\n'); fmax=fmaxold; else CallTfrView=1; end; elseif (choice==ChoiceThreshold), % Change the threshold fprintf(' Old threshold: %f\n', threshold); throld=threshold; threshold=input(' New threshold: '); if isempty(threshold), threshold=throld; CallTfrView=0; else CallTfrView=1; end elseif (choice==ChoiceLinlog), % Change the lin/log scale of tfr linlogtfr=1-linlogtfr; elseif (choice==ChoiceRedraw), % redraw ? RefreshFigure=1-RefreshFigure; if RefreshFigure==1, CallTfrView=1; end; elseif (choice==ChoiceNewFigure), % new figure figure; CallTfrView=1; elseif (choice==ChoiceSaveResults), % Save the results f=freq*fs; Nmethod=length(method); if comp(1:2)=='PC', DefaultName=[method(4:Nmethod),num2str(Nsig),'.mat']; [name,PathWorkDir] = uiputfile(DefaultName, 'Save As'); else DefaultName=[method(4:Nmethod),num2str(Nsig)]; nameStr=[' Name of the MAT file [',DefaultName,'] : ']; name=input(nameStr,'s'); while (length(name)>8), disp(' The name must have less than 8 characters'); name=input(nameStr,'s'); end if isempty(name), name=DefaultName; end PathWorkDir=''; end linlog=linlogtfr+2*linlogspec+4*sigenveloppe; isgrid=isgridsig+2*isgridspec+4*isgridtfr; param = [display,linlog,threshold,levelnumb,Nf2,layout,fs,isgrid,fmin,fmax]; SavedColorMap=colormap; if (nargin<=4), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method)']; TfrView =['clf;colormap(SavedColorMap); tfrview(tfr,sig,t,method,param)']; eval(['save ',PathWorkDir,name,... ' tfr sig t f fs method param SavedColorMap TfrView TfrQView']); elseif (nargin==5), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method,p1)']; TfrView =['clf; colormap(SavedColorMap); tfrview(tfr,sig,t,method,param,p1)']; eval(['save ',PathWorkDir,name, ... ' tfr sig t f fs method param p1 SavedColorMap TfrView TfrQView']); elseif (nargin==6), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method,p1,p2)']; TfrView =['clf; colormap(SavedColorMap); tfrview(tfr,sig,t,method,param,p1,p2)']; eval(['save ',PathWorkDir,name,... ' tfr sig t f fs method param p1 p2 SavedColorMap TfrView TfrQView']); elseif (nargin==7), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method,p1,p2,p3)']; TfrView =['clf; colormap(SavedColorMap); tfrview(tfr,sig,t,method,param,p1,p2,p3)']; eval(['save ',PathWorkDir,name,... ' tfr sig t f fs method param p1 p2 p3 SavedColorMap TfrView TfrQView']); elseif (nargin==8), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method,p1,p2,p3,p4)']; TfrView =['clf; colormap(SavedColorMap); tfrview(tfr,sig,t,method,param,p1,p2,p3,p4)']; eval(['save ',PathWorkDir,name,... ' tfr sig t f fs method param p1 p2 p3 p4 SavedColorMap TfrView TfrQView']); elseif (nargin==9), TfrQView=['colormap(SavedColorMap); tfrqview(tfr,sig,t,method,p1,p2,p3,p4,p5)']; TfrView =['clf; colormap(SavedColorMap); tfrview(tfr,sig,t,method,param,p1,p2,p3,p4,p5)']; eval(['save ',PathWorkDir,name,... ' tfr sig t f fs method param p1 p2 p3 p4 p5 SavedColorMap TfrView TfrQView']); end; disp(' '); fprintf('The file is saved in the directory %s\n',PathWorkDir); fprintf('under the name %s\n',name); fprintf('If you want to find again the exact layout of this screen, do\n'); fprintf('load %s%s; eval(TfrView);\n\n', PathWorkDir,name); fprintf('If you want to restart the display session under tfrqview, do\n'); fprintf('load %s%s; eval(TfrQView);\n',PathWorkDir,name); CallTfrView=0; elseif (choice==ChoiceSaveOptions), % Save options SavedColorMap=colormap; save options fs fmin fmax threshold linlogtfr linlogspec levelnumb ... display layout colmap SavedColorMap iscolorbar ... isgridsig isgridspec isgridtfr issig sigenveloppe isspec; fprintf('\n Options saved\n'); CallTfrView=0; elseif (choice==ChoicePrint), % Print the current figure Nmethod=length(method); if comp(1:2)=='PC', DefaultName=[method(4:Nmethod),num2str(Nsig),'.eps']; [name,PathWorkDir] = uiputfile(DefaultName, 'Save As'); else DefaultName=[method(4:Nmethod),num2str(Nsig)]; nameStr=[' Name of the EPS file [',DefaultName,'] : ']; name=input(nameStr,'s'); while (length(name)>8), disp('The name must have less than 8 characters'); name=input(nameStr,'s'); end if isempty(name), name=DefaultName; end end eval(['print -deps ',PathWorkDir,name]); fprintf(' The file is saved in the directory %s\n',PathWorkDir); fprintf('under the name %s\n',name); CallTfrView=0; end;end;% good bye. I hope that everything happened fine.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -