How to eliminate value at each position required

1 Ansicht (letzte 30 Tage)
yasmin
yasmin am 20 Feb. 2016
Kommentiert: MHN am 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.
load('EveryProjectionNormDEliminateSpike_max_same_v2.mat');
% ---------- 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

Antworten (1)

MHN
MHN am 20 Feb. 2016
Bearbeitet: MHN am 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
  1 Kommentar
MHN
MHN am 20 Feb. 2016
There are more efficient way rather than 4 nested loop, but I just corrected your code.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by