📄 da_coeff_histogram.m
字号:
function da_coeff_histogram(da,coeff_names);
% DA_COEFF_HISTOGRAM(da,coeff_names) plot histograms for selected coeffs with the names in
% array coeff_names;
% da - discriminant model
% example: da_coeff_histogram(da,{'c2' 'c0 (-discr. fun.)'});
%
% last modified 5.02.05
str=da.coefficients_txt;
str=[{'c0 (-discr. fun.)'} str];
if nargin<2
[selection,ok] = listdlg('PromptString','Select coefficients:',...
'SelectionMode','multiple','ListString',str);
else
ok=0;
selection=[];
for i=1:length(coeff_names)
for j=1:length(str)
if strcmp(str{j},coeff_names{i})
ok=1;
selection=[selection j];
end
end
end
end
if ok
Data=[-da.discriminant_func da.coeff_data];
N=length(selection);
Fignumbs=floor(N/3);
Additaxes=mod(N,3);
tempHandleA=[];
tempHandleF=[];
for i=1:Fignumbs
tempHandleF(i)=figure('Units','characters',...
'Name',['DA Coefficients Histogram: ' num2str(selection(3*(i-1)+1)) ',' num2str(selection(3*(i-1)+2)) ',' num2str(selection(3*(i-1)+3)) ' (' str{selection(3*(i-1)+1)} ', ' str{selection(3*(i-1)+2)} ', ' str{selection(3*(i-1)+3)} ')'],...
'NumberTitle','off','color',[1 1 1]);
for j=1:3
tempHandleA=[tempHandleA subplot(3,1,j)];
DrawHist(Data(:,selection(3*(i-1)+j)));
set(ylabel(str{selection(3*(i-1)+j)}),'Interpreter','none');
drawnow;
end
end
if Additaxes==1
tempHandleF(end+1)=figure('Units','characters',...
'Name',['DA Coefficients Histogram: ' num2str(selection(3*Fignumbs+1)) ' (' str{selection(3*Fignumbs+1)} ' )'],...
'NumberTitle','off','color',[1 1 1]);
end
if Additaxes==2
tempHandleF(end+1)=figure('Units','characters',...
'Name',['DA Coefficients Histogram: ' num2str(selection(3*Fignumbs+1)) ',' num2str(selection(3*Fignumbs+2)) ' (' str{selection(3*Fignumbs+1)} ', ' str{selection(3*Fignumbs+2)} ')'],...
'NumberTitle','off','color',[1 1 1]);
end
for i=1:Additaxes
tempHandleA=[tempHandleA subplot(3,1,i)];
DrawHist(Data(:,selection(3*Fignumbs+i)));
set(ylabel(str{selection(3*Fignumbs+i)}),'Interpreter','none');
end
set(tempHandleA,'fontsize',8);
end
function DrawHist(Y);
% Y must be vector
m=min(Y); M=max(Y);
if m~=M
N=ceil(sqrt(length(Y)));
X=m:(M-m)/N:M;
hist(Y,X);
else
hist(Y)
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -