0001 function [I,Ib] = set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 warning('EIDORS:deprecated','SET_3D_CURRENTS is deprecated as of 07-Jun-2012. ');
0020
0021 [vr,vc] = size(vtx);
0022
0023 [el_no,q] = size(elec);
0024
0025 el_pp = el_no/no_pl;
0026
0027 a=1:el_no;
0028
0029 X = reshape(a,el_pp,no_pl)';
0030
0031 if protocol == '{op}'
0032
0033 Ib = [];
0034
0035 for i=1:no_pl
0036
0037 this_plane = X(i,:);
0038
0039 for j=this_plane(1):this_plane(8)
0040
0041 Ip = zeros(el_no,1);
0042 Ip(j) = 1;
0043 Ip(j+ el_pp/2) = -1;
0044 Ib = [Ib,Ip];
0045 end
0046
0047 end
0048
0049
0050 Is_supl = zeros(vr,size(Ib,2));
0051
0052 I = [Is_supl;Ib];
0053
0054 I(gnd_ind,:) = 0;
0055
0056 elseif protocol == '{ad}'
0057
0058 Ib = [];
0059
0060 for i=1:no_pl
0061
0062 this_plane = X(i,:);
0063
0064 for j=this_plane(1):this_plane(el_pp-1)
0065
0066 Ip = zeros(el_no,1);
0067 Ip(j) = 1;
0068 Ip(j+1) = -1;
0069 Ib =[Ib,Ip];
0070
0071 if j==this_plane(el_pp-1)
0072
0073 Ip = zeros(el_no,1);
0074
0075 Ip(j+1) = 1;
0076 Ip(this_plane(1)) = -1;
0077 Ib = [Ib,Ip];
0078 end
0079
0080
0081 end
0082
0083 end
0084
0085 Is_supl = zeros(vr,size(Ib,2));
0086
0087 I = [Is_supl;Ib];
0088
0089 I(gnd_ind,:) = 0;
0090
0091 else
0092 error(['protocol ',protocol,' is not recognized']);
0093 end
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104