factor.m
来自「细胞生长结构可视化工具箱-MATLAB Toolbox1999.zip」· M 代码 · 共 104 行
M
104 行
% Plot values of a particular input dimension across the grid
% New version using triangular transorfm to original space
% rather than interpolating invis space.
function factor(GcsProj);
%UpdateStatus('Factor Analysis',[ 0 1 0 ]);
GcsProj.Gcs.Status = 'Factor Analysis';
GcsProj.Gcs.StatusColour = [0 1 0];
UpdateGUI;
Gcs = GcsProj.Gcs;
if strcmp(Gcs.Trained,'Yes')
%eval(['load ',filename]);
spx = 1;
spy = 1;
mod = spx*spy; % Nodiagrams per figure
hwait = waitbar(0,'Performing Factor Analysis ...');
for dim = 1:Gcs.n; % dimension to be plotted
wdim = zeros(size(Gcs.wvis,1),3);
for i=1:size(Gcs.wvis,1)
wdim(i,:) = [Gcs.wvis(i,:),Gcs.w(i,dim)];
end
extent; %Calculate min and max values of x and y
% Calculate the values across the plot
Act=[];
%Gcs.NoPts=30; % Should already be set!
ipmap=zeros(Gcs.NoPts+1);
minval = 99999999; % minimum value of dimension encountered
back = []; % indeces of background coords
ii=0;
xi=minx:(maxx-minx)/Gcs.NoPts:maxx;
yi=miny:(maxy-miny)/Gcs.NoPts:maxy;
for i=minx:(maxx-minx)/Gcs.NoPts:maxx
ii=ii+1;
jj=Gcs.NoPts+2;
for j=maxy:-(maxy-miny)/Gcs.NoPts:miny
jj=jj-1;
Ip=[i,j];
figure(hwait);
waitbar( ((ii-1)*Gcs.NoPts + Gcs.NoPts-jj+1)/(Gcs.NoPts.^2*Gcs.n) + (dim-1)/Gcs.n );
% Find enclosing triangle
tri = findtri(Ip,Gcs.wvis,Gcs.C);
if ~isempty(tri)
% Transform pt to N-D space
Ipn = trans2n(Ip,Gcs.wvis(tri(1),:),Gcs.wvis(tri(2),:),Gcs.wvis(tri(3),:), Gcs.w(tri(1),:),Gcs.w(tri(2),:),Gcs.w(tri(3),:));
Ipmap(jj,ii) = Ipn(dim);
if Ipn(dim) < minval
minval = Ipn(dim);
end
else
back = [back;jj,ii];
Ipmap(jj,ii) = 0;
end
end
end
%Ipmap2=Ipmap;
%Ipmap2(back(:,1),back(:,2))=minval*ones(size(Ipmap2(back(:,1),back(:,2))));
for i=1:size(back,1)
Ipmap(back(i,1),back(i,2)) = minval;
end
%figure(6+floor((dim-1)/mod));
figure;
subplot(spx,spy,(rem(dim-1,mod))+1);
cla;
orient landscape;
colormap(Gcs.c);
% if normalisation was used then calc a scale value to undo it
if size(Gcs.NormF1,1)>0 % If there was no normalisation then NormF1 = []
% if (eval(['size(Gcs.NormF' int2str(dim) ',1) > 0']))
eval(['scale = Gcs.NormF' int2str(dim) ';']);
else
scale = 1;
end
imagesc(xi,yi,Ipmap*scale)% -ones(size(Ipmap))*minval); %
set(gca,'YDir','normal')
colorbar;
plotv2(Gcs);
if isempty(GcsProj.IpLabels)
title(['dimension ',int2str(dim)]);
else
title([ GcsProj.IpLabels(dim,1:size(GcsProj.IpLabels(dim,:),2)-1) ]);
end
drawnow;
end
close(hwait);
else
uiwait(errordlg('Network Must be trained before visualisation plots are created!'));
end
%UpdateStatus('Idle','default');
GcsProj.Gcs.Status = 'Idle';
GcsProj.Gcs.StatusColour = 'default';
UpdateGUI;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?