📄 frameinfo.m
字号:
function varargout=FrameInfo(MatFile,Display)% FrameInfo Display information about the frame stored in a mat-file,
% The mat-file is opened and some information is displayed.
% Only files with the 'mat' extension are considered
%
% [t1,t2]=FrameInfo(MatFile,Display);
%--------------------------------------------------------------------------------
% arguments:
% t1 - a char array containing one line of information for every
% mat-file that match MatFile
% t2 - contains all information about the last mat-file that match MatFile
% MatFile - the filename, wildchars may be used
% also the file extension may be omitted, ex MatFile='F*';
% Display - 1: display information on screen
% 0: or omitted, do not display information on screen
%--------------------------------------------------------------------------------
%----------------------------------------------------------------------
% Copyright (c) 2000. Karl Skretting. All rights reserved.
% Hogskolen in Stavanger (Stavanger University), Signal Processing Group
% Mail: karl.skretting@tn.his.no Homepage: http://www.ux.his.no/~karlsk/
%
% HISTORY: dd.mm.yyyy
% Ver. 1.0 15.12.2000 KS: function made
% Ver. 1.1 27.11.2002 KS: moved from ..\Frames\MFcontent.m to ..\FrameTools%----------------------------------------------------------------------
Mfile='FrameInfo';
if (nargin<1); MatFile='*.mat'; end;
if (nargin<2); Display=0; end;
t1=MatFile(max(length(MatFile)-3,1):length(MatFile));
if ~strcmp(t1,'.mat');
MatFile=[MatFile,'.mat'];
end
D=dir(MatFile);
% t1 is one line for each file
t1=[Mfile,': files in ',pwd,'\',MatFile,' ',datestr(now)];
S1='';S2='';t2='';
if Display; disp(t1); end;
for d=1:length(D);
% t2 is many lines about the last mat-file
t2=[Mfile,': Some general information on ',D(d).name];
t2=char(t2,[D(d).name,' contains the following variables:']);
t2=char(t2,' Name Size Class Contents');
t2=char(t2,' ----------- -------- -------- -----------------');
t3=D(d).name;
t3=[t3,blanks(25-length(t3)),' 0 it. using 0 xD'];
if Display; disp(t2); end; S1=whos;
load(D(d).name);
S2=whos;
for i=1:length(S2) % do all the variables i workspace now
j=1;
while j<=length(S1) % was it in the workspace before, or from the mat-file
if strcmp(S2(i).name,S1(j).name); break; end;
j=j+1;
end
if j>length(S1)
% this, S2(i).name, variable was in the mat-file
t=[' ',S2(i).name,' '];
t=[t,blanks(15-length(t))];
for k=1:(length(S2(i).size)-1); t=[t,int2str(S2(i).size(k)),'x']; end;
t=[t,int2str(S2(i).size(length(S2(i).size))),' '];
t=[t,blanks(25-length(t)),S2(i).class,blanks(10-length(S2(i).class))];
if strcmp(S2(i).class,'double') & prod(S2(i).size)==1
t=[t,num2str(eval(S2(i).name))];
end
if strcmp(S2(i).class,'char') & (S2(i).size(1)==1)
temp=eval(S2(i).name);
t=[t,temp(1:(min(length(temp),30)))];
end
if strcmp(S2(i).name,'Class')
% t3=[t3,' Signal:',Class];
t3=[t3,' ',Class,' signals']; % signal class right after xD in t3
end
if strcmp(S2(i).name,'Type')
if strcmp(Type,'b'); t3=[t3,' block-oriented frame']; end;
if strcmp(Type,'o'); t3=[t3,' overlapping frame']; end;
if strcmp(Type,'g'); t3=[t3,' general frame']; end;
if strcmp(Type,'s'); t3=[t3,' separable frame']; end;
if strcmp(Type,'t'); t3=[t3,' tree-structured filter bank']; end;
end
if strcmp(S2(i).name,'Mdim')
t3(44)=int2str(Mdim);
end
if strcmp(S2(i).name,'Mdat')
t3((43-length(int2str(Mdat))):42)=int2str(Mdat);
end
if strcmp(S2(i).name,'SNRtot')
t3((30-length(int2str(size(SNRtot,2)))):29)=int2str(size(SNRtot,2));
end
if strcmp(S2(i).name,'SizeF')
for k=1:(length(SizeF)-1); t=[t,int2str(SizeF(k)),', ']; end;
t=[t,int2str(SizeF(length(SizeF)))];
t3=[t3,' SizeF='];
for k=1:(length(SizeF)-1); t3=[t3,int2str(SizeF(k)),'x']; end;
t3=[t3,int2str(SizeF(length(SizeF)))];
end
if strcmp(S2(i).name,'SizeX')
for k=1:(length(SizeX)-1); t=[t,int2str(SizeX(k)),', ']; end;
t=[t,int2str(SizeX(length(SizeX)))];
t3=[t3,' SizeX='];
for k=1:(length(SizeX)-1); t3=[t3,int2str(SizeX(k)),'x']; end;
t3=[t3,int2str(SizeX(length(SizeX)))];
end
if strcmp(S2(i).name,'History')
if Display; disp(t); end;
t2=char(t2,t);
for k=1:(min(5,size(History,1)))
t=[' ',History(k,1:(min(90,length(History(k,:)))))];
if Display; disp(t); end;
t2=char(t2,t);
end
k=size(History,1);
if k>5
t=[' ..',History(k,1:(min(90,length(History(k,:)))))];
if Display; disp(t); end;
t2=char(t2,t);
end
t='';
end
if strcmp(S2(i).name,'PreProc')
t=[t,PreProc.Prog1];
if length(PreProc.Prog2)
t=[t,', ',PreProc.Prog2,'(',int2str(PreProc.Method)];
if strcmp(class(PreProc.arg1),'double')
if prod(size(PreProc.arg1))==1
t=[t,',',num2str(PreProc.arg1)];
elseif prod(size(PreProc.arg1))>1
t=[t,',arg1'];
end
end
if strcmp(class(PreProc.arg2),'double')
if prod(size(PreProc.arg2))==1
t=[t,',',num2str(PreProc.arg2)];
elseif prod(size(PreProc.arg2))>1
t=[t,',arg2'];
end
end
if strcmp(class(PreProc.arg3),'double')
if prod(size(PreProc.arg3))==1
t=[t,',',num2str(PreProc.arg3)];
elseif prod(size(PreProc.arg3))>1
t=[t,',arg3'];
end
end
t=[t,')'];
end
end
if strcmp(S2(i).name,'InitialF')
if length(InitialF.Prog1)
t=[t,InitialF.Prog1,'('];
if strcmp(class(InitialF.arg1),'double')
if prod(size(InitialF.arg1))==1
t=[t,num2str(InitialF.arg1)];
elseif prod(size(InitialF.arg1))>1
t=[t,'arg1'];
end
elseif strcmp(class(InitialF.arg1),'char')
if length(InitialF.arg1)<10
t=[t,'''',InitialF.arg1,''''];
elseif prod(size(InitialF.arg1))>1
t=[t,'arg1'];
end
end
if strcmp(class(InitialF.arg2),'double')
if prod(size(InitialF.arg2))==1
t=[t,',',num2str(InitialF.arg2)];
elseif prod(size(InitialF.arg2))>1
t=[t,',arg2'];
end
elseif strcmp(class(InitialF.arg2),'char')
if length(InitialF.arg2)<10
t=[t,',','''',InitialF.arg2,''''];
elseif prod(size(InitialF.arg2))>1
t=[t,',arg2'];
end
end
if strcmp(class(InitialF.arg3),'double')
if prod(size(InitialF.arg3))==1
t=[t,',',num2str(InitialF.arg3)];
elseif prod(size(InitialF.arg3))>1
t=[t,',arg3'];
end
elseif strcmp(class(InitialF.arg3),'char')
if length(InitialF.arg3)<10
t=[t,',','''',InitialF.arg3,''''];
elseif prod(size(InitialF.arg3))>1
t=[t,',arg3'];
end
end
if strcmp(class(InitialF.arg4),'double')
if prod(size(InitialF.arg4))==1
t=[t,',',num2str(InitialF.arg4)];
elseif prod(size(InitialF.arg4))>1
t=[t,',arg4'];
end
elseif strcmp(class(InitialF.arg4),'char')
if length(InitialF.arg4)<10
t=[t,',','''',InitialF.arg4,''''];
elseif prod(size(InitialF.arg4))>1
t=[t,',arg4'];
end
end
if strcmp(class(InitialF.arg5),'double')
if prod(size(InitialF.arg5))==1
t=[t,',',num2str(InitialF.arg5)];
elseif prod(size(InitialF.arg5))>1
t=[t,',arg5'];
end
elseif strcmp(class(InitialF.arg5),'char')
if length(InitialF.arg5)<10
t=[t,',','''',InitialF.arg5,''''];
elseif prod(size(InitialF.arg5))>1
t=[t,',arg5'];
end
end
t=[t,')'];
end
end
if strcmp(S2(i).name,'VecSel')
if length(VecSel.Prog1)
if strcmp(VecSel.Prog1,'BlockVS')
t=[t,VecSel.Prog1,'(...,']; % some arguments used
else
t=[t,VecSel.Prog1,'(X,F,S,'];
end
if strcmp(class(VecSel.arg1),'double')
if prod(size(VecSel.arg1))==1
t=[t,num2str(VecSel.arg1)];
elseif prod(size(VecSel.arg1))>1
t=[t,'arg1'];
end
elseif strcmp(class(VecSel.arg1),'char')
if length(VecSel.arg1)<10
t=[t,'''',VecSel.arg1,''''];
elseif prod(size(VecSel.arg1))>1
t=[t,'arg1'];
end
end
if strcmp(class(VecSel.arg2),'double')
if prod(size(VecSel.arg2))==1
t=[t,',',num2str(VecSel.arg2)];
elseif prod(size(VecSel.arg2))>1
t=[t,',arg2'];
end
elseif strcmp(class(VecSel.arg2),'char')
if length(VecSel.arg2)<10
t=[t,',','''',VecSel.arg2,''''];
elseif prod(size(VecSel.arg2))>1
t=[t,',arg2'];
end
end
if strcmp(class(VecSel.arg3),'double')
if prod(size(VecSel.arg3))==1
t=[t,',',num2str(VecSel.arg3)];
elseif prod(size(VecSel.arg3))>1
t=[t,',arg3'];
end
elseif strcmp(class(VecSel.arg3),'char')
if length(VecSel.arg3)<10
t=[t,',','''',VecSel.arg3,''''];
elseif prod(size(VecSel.arg3))>1
t=[t,',arg3'];
end
end
if strcmp(class(VecSel.arg4),'double')
if prod(size(VecSel.arg4))==1
t=[t,',',num2str(VecSel.arg4)];
elseif prod(size(VecSel.arg4))>1
t=[t,',arg4'];
end
elseif strcmp(class(VecSel.arg4),'char')
if length(VecSel.arg4)<10
t=[t,',','''',VecSel.arg4,''''];
elseif prod(size(VecSel.arg4))>1
t=[t,',arg4'];
end
end
if strcmp(class(VecSel.arg5),'double')
if prod(size(VecSel.arg5))==1
t=[t,',',num2str(VecSel.arg5)];
elseif prod(size(VecSel.arg5))>1
t=[t,',arg5'];
end
elseif strcmp(class(VecSel.arg5),'char')
if length(VecSel.arg5)<10
t=[t,',','''',VecSel.arg5,''''];
elseif prod(size(VecSel.arg5))>1
t=[t,',arg5'];
end
end
t=[t,')'];
end
end
if length(t)
if Display; disp(t); end;
t2=char(t2,t);
end
clear(S2(i).name);
end
end
t1=char(t1,t3);
end
t1=[t1(1,:);sortrows(t1(2:size(t1,1),:))];
if nargout>=1; varargout(1)={t1}; end
if nargout>=2; varargout(2)={t2}; end
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -