# How to eliminate value at each position required

1 view (last 30 days)
yasmin on 20 Feb 2016
Commented: MHN on 20 Feb 2016
Hi,
I have an array of matrix in the a=cell (1,16). Each of the array matrix in the cell is equal to 128x128. Then, I did the multiplication between each of column of the cell so that I can get a pair projection of 128x128 of each matrix. I.e: E{i,j}. Thus, I will get E{1,2}, E{1,3}..till..E{16,16} and each of E{i,j} has 128x128 array matrix.
From each of the pair projection, I want to eliminate the value at certain position in the 128x128 matrix. For example, at position (31,119), (13,102), (98,10) and (11,27)in each pair projection of E{i,j}, I want the value becomes zero.
how can I write the code? Can anybody guide how to write a correct code for this function. I have tried to write the code but it consists an error.
% ---------- Dot product to get each pairing projection -----------
i=1;
for i=1:16;
m1=EachProj_EliminateSpike_MaxSpike_v2{1,i};
for j=1:16
m2=EachProj_EliminateSpike_MaxSpike_v2{1,j};
c=m1.*m2; % Do the element multiplication to get Ei,j
E{i,j}=c;
end
end
% eliminate position has spike equal to zero
for i=1:16;
for j=1:16;
for Tx=1:128;
for Rx =1:128;
if E{i,j}(Rx,Tx)= E{i,j}(31,119);E{i,j}(31,119)=0;end
if E{i,j}(Rx,Tx)= E{i,j}(98,10);E{i,j}(98,10)=0;end
end
end
end
end

MHN on 20 Feb 2016
Edited: MHN on 20 Feb 2016
for i=1:16;
for j=1:16;
for Tx=1:128;
for Rx =1:128;
if E{i,j}(Rx,Tx)==E{i,j}(31,119)
E{i,j}(31,119)=0;
end
if E{i,j}(Rx,Tx)==E{i,j}(98,10)
E{i,j}(98,10)=0;
end
end
end
end
MHN on 20 Feb 2016
There are more efficient way rather than 4 nested loop, but I just corrected your code.