📄 mfbox_pos_selectcomp_run.m
字号:
function [A,W,S,params,reliability]=mfbox_pos_selectcomp_run(A,W,S,X,params,runflag)% select and label components%% Usage:% [A,W,S,params,reliability]=mfbox_pos_selectcomp_run(A,W,S,X,params,runflag)%% X - cell with% (NxT) data% (Tx3) grid% timeline% mask% design% reference% A - (TxD) mixing matrix% W - (DxT) demixing matrix% S - struct with% dat - (MxD) components (M<=N unique datapoints)% mask - mask selecting unique subset of grid% part - cell array containing the different parts % of the analysis% map - (TxC) maps (timestep,component) to element in% 1...D (D>=C)% spatialnoisevar - (Mx1) spatial variance of the noise% temporalnoisevar - (Tx1) temporal variance of the noise% names - (Cx1) cell with names% params - struct with% mapping - (Cx1) mapping of components% names - (Cx1) cell with names% reliability - struct% runflag - -1 get default parameter% 0 interactive ask parameters% 1 interactive ask parameters and run% 2 run%% Copyright by Peter Gruber and Fabian J. Theis% Signal Processing & Information Theory group% Institute of Biophysics, University of Regensburg, Germany% Homepage: http://research.fabian.theis.name% http://www-aglang.uni-regensburg.de%% This file is free software, subject to the % GNU GENERAL PUBLIC LICENSE, see gpl.txterror(nargchk(3,6,nargin));error(nargchk(1,5,nargout));if (nargin<4), X = []; endif (nargin<5), params = []; endif (nargin<6), runflag = 1; ends = size(S.dat);dim = s(1:(end-1));n = size(S.map,2);timesteps = size(A,1);params = mfbox_checkparam(params,'pos','selectcomp', ... struct('mapping',1:n,'names', ... {mat2cell(char(zeros(0,n)),0,ones(1,n))}));reliability = struct();if (abs(runflag-0.5)<1) if (exist('OCTAVE_HOME')~=5)% matlab params = mfbox_pos_selectcompg(A,W,S,X,params); endendif (runflag>0 && isstruct(params)) nn = 1; nm = zeros(size(S.map)); nA = zeros(size(A,1),0); nS = zeros(size(S.dat,1),0); nW = zeros(0,size(W,2)); newnames = {}; for i=1:n p = (params.mapping==i); if (sum(p)>0) nA(:,nn) = sum(A(:,p),2); q = sort(S.map(:,p)')'; u = unique(q,'rows'); for j=1:size(u,1) l = size(nS,2); nS(:,l+1) = sum(S.dat(:,u(j,:)),2)/size(u,2); for k=1:size(nm,1) r = find(p); if (all(q(k,:)==u(j,:))), nm(k,r(1)) = l+1; end end end nW(nn,:) = sum(W(p,:),1); newnames{nn} = params.names{find(p,1)}; nn = nn+1; end end A = nA; W = nW; S.map = reshape(nm(:,nm(1,:)>0),size(nm,1),[]); S.dat = nS; S.tag = newnames;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -