f



search between two matrices

Hi,

I have two matrices 6x6

A = [0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 0 0];
B = [0 0 0 0 0 0; 0 0 1 1 0 0; 0 1 0 1 1 0; 0 0 1 1 0 0; 0 1 1 0 0 0; 0 0 0 0 0 0];

I would like to find the i,j = 1 of matrix A and then search in matrix B the two positions that I got from matrix A and sum the entries in B that belong to B(i-2:i+2,j-2:j+2). Then write a new matrix C that has the same dimensions, i.e. 6x6, but now with the summed values at the same position as i,j = 1 from A.

Thanks
0
Oliver
12/17/2016 7:28:03 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
475 Views

Similar Articles

[PageSpeed] 3

Reply: