I have 2 matrices Z and Y, both are a 10×1300 matrix and consists of random numbers, how do i add data to the left and right of each element and then use indexing to find Y for a certain value of Z
For example,
Z [10 1300] Y [10 1300]One element in Z: Z(1,1)=10z=Z(1,1)Add data to left and right side, z-3,z-2,z-1,z,z+1,z+2,z+3 Final result: 7,8,9,10,11,12,13
Similar for Y but with different data additions
One element in Y: Y(1,1)=20y=Y(1,1)Add data to left and right side, y+3,y+2,y+1,y,y+1,y+2,y+3 Final result: 23,22,21,20,21,22,23
Use indexing to find Z=7 then find the respective element from Y would give Y= 23,
Y(find(Z==7))=23Z=8,Y=22Z=9,Y=21Z=10,Y=20Z=11,Y=21Z=12,Y=22Z=13,Z=23
Best Answer