How to remove specific portion of the matrix?

1 次查看(过去 30 天)
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?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-3-26
编辑:Azzi Abdelmalek 2016-3-26
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by