How to remove specific portion of the matrix?

1 view (last 30 days)
0 0 0 0 0 0 0 0 0
0 1 4 8 12 16 14 5 0
0 3 12 24 36 48 42 15 0
0 4 16 32 48 64 56 20 0
0 4 16 32 48 64 56 20 0
0 4 16 32 48 64 56 20 0
0 3 12 24 36 48 42 15 0
0 1 4 8 12 16 14 5 0
0 0 0 0 0 0 0 0 0
This is my output matrix of size 9x9. But my desired output matrix is only 5x5. It starts from (3,3) to (7,7) from which the output image can be of size 5x5. I tried reshaping. But got some errors. I am just starting to learn Matlab. I tried REMOVEROWS function. But I am not getting the desired output. My desired output should be something like this.
12 24 36 48 42
16 32 48 64 56
16 32 48 64 56
16 32 48 64 56
12 24 36 48 42
Can anyone please help me?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Mar 2016
Edited: Azzi Abdelmalek on 26 Mar 2016
A=[0 0 0 0 0 0 0 0 0
0 1 4 8 12 16 14 5 0
0 3 12 24 36 48 42 15 0
0 4 16 32 48 64 56 20 0
0 4 16 32 48 64 56 20 0
0 4 16 32 48 64 56 20 0
0 3 12 24 36 48 42 15 0
0 1 4 8 12 16 14 5 0
0 0 0 0 0 0 0 0 0]
B= A(3:7,3:7)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!