How to remove specific portion of the matrix?

8 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 26 Mar 2016
Modificato: Azzi Abdelmalek il 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)

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by