Home > vbmeg > functions > estimation > bayes > vb_current_area_info.m

vb_current_area_info

PURPOSE ^

find selected area index in current file

SYNOPSIS ^

function [ix_act_ex, jx_act_ex, ix_act, jx_act, Wact, Lact] =vb_current_area_info(Jinfo,ix_area)

DESCRIPTION ^

 find selected area index in current file

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ix_act_ex, jx_act_ex, ix_act, jx_act, Wact, Lact] = ...
0002           vb_current_area_info(Jinfo,ix_area)
0003 % find selected area index in current file
0004 %
0005 % Copyright (C) 2011, ATR All Rights Reserved.
0006 % License : New BSD License(see VBMEG_LICENSE.txt)
0007 
0008 Lact =Jinfo.Lact ;
0009 ix_act =Jinfo.ix_act ;
0010 Nact = length(ix_act);
0011 
0012 if isfield(Jinfo,'ix_act_ex')
0013     % Z-current
0014     ix_act_ex = Jinfo.ix_act_ex ;
0015     Nact_ex = length(ix_act_ex);
0016     
0017     if ~isempty(ix_area),
0018         % Select vertex index 'ix_area' within the active current region
0019         [jx_act_ex, ix_act_ex] = vb_index2indexsub(ix_area, ix_act_ex);
0020     else
0021         jx_act_ex = 1:length(ix_act_ex);
0022     end
0023     
0024     Wact = Jinfo.Wact ;
0025     Wact = Wact(jx_act_ex,:);
0026 
0027     % active index of Z-current
0028     jx_act = find( sum(Wact, 1) > 0);
0029     Wact   = Wact(:,jx_act);
0030     ix_act = ix_act(jx_act);
0031     if Lact > 1
0032         jx_act = repmat(jx_act(:),1,Lact) ...
0033                + repmat([0:Lact-1]*Nact,length(jx_act),1);
0034         jx_act_ex = repmat(jx_act_ex(:),1,Lact) ...
0035                   + repmat([0:Lact-1]*Nact_ex,length(jx_act_ex),1);
0036         jx_act = jx_act(:);
0037         jx_act_ex = jx_act_ex(:);
0038     end
0039 else
0040     % J-current
0041     if ~isempty(ix_area),
0042         % Select vertex index 'ix_area' within the active current region
0043         [jx_act, ix_act] = vb_index2indexsub(ix_area, ix_act);
0044     else
0045         jx_act = 1:length(ix_act);
0046     end
0047     
0048     if Lact > 1
0049         jx_act = repmat(jx_act(:),1,Lact) ...
0050                + repmat([0:Lact-1]*Nact,length(jx_act),1);
0051         jx_act = jx_act(:);
0052     end
0053 
0054     ix_act_ex = ix_act;
0055     jx_act_ex = jx_act;
0056     Wact = [];
0057 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005