0001 function [Vext,FL,FR] = vb_calc_subj_patch(IL,IR,VLs,FLs,VRs,FRs)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 NL = length(IL);
0013 NR = length(IR);
0014
0015 NLall = size(VLs, 1);
0016 NRall = size(VRs, 1);
0017
0018 IL_extra = vb_setdiff2([1:NLall],IL);
0019 IR_extra = vb_setdiff2([1:NRall],IR);
0020
0021 NL_extra = length(IL_extra);
0022 NR_extra = length(IR_extra);
0023
0024
0025 Vext = [VLs(IL_extra,:); VRs(IR_extra,:)]/1000;
0026 Nall = size(Vext,1) + NL + NR;
0027
0028 if Nall ~= (NLall + NRall),
0029 error('dimension error')
0030 end
0031
0032
0033
0034
0035 ItransL = zeros(NLall,1);
0036 ItransR = zeros(NRall,1);
0037
0038 ItransL(IL) = 1:NL;
0039 ItransL(IL_extra) = (1:NL_extra) + (NL + NR);
0040
0041 ItransR(IR) = (1:NR) + NL;
0042 ItransR(IR_extra) = (1:NR_extra) + (NL + NR + NL_extra);
0043
0044 FL = ItransL(FLs);
0045 FR = ItransR(FRs);
0046
0047 ix = find( FL(:,1).*FL(:,2).*FL(:,3) > 0);
0048 FL = FL(ix,:);
0049
0050 ix = find( FR(:,1).*FR(:,2).*FR(:,3) > 0);
0051 FR = FR(ix,:);
0052