
Supose I have a matrix. This matrix is blank except some points that create rectangles with the same size. Every point that creates a rectangle has a positive number that is equal for all the points of that rectangle. It is posible that this matrix have several rectangles each with the same number.
Imagine now I have a second matrix with the same structure but now the rectangles are in other positions with an other size and an other values just as matrix A and B in the picture.
I want to combine both matrix so if there’s an intertection of some rectangle, the rectangle with the minimum number is erased.
Which is the best way to do it? I think that it can be posible doing fors but I want to do it 30 times so it will take a lot of time for Octave to complete it if I don’t improve it.
I have made this small code that seem to do the job:
output: