How to reduce an existing matrix

6 次查看(过去 30 天)
I would like to reduce an existing matrix (1885x1885) to (188x188), essentially discarding the last 5 rows and columns.
How would I code this. Thanks in advance.

采纳的回答

Roger Stafford
Roger Stafford 2013-8-4
I think you mean reduce it to (1880x1880).
M = M(1:end-5,1:end-5);

更多回答(3 个)

Sausan Khomusi
Sausan Khomusi 2013-8-4
Partially yes. I would like to then reduce the (1880 X 1880) matrix to every 10th row and every 10th column. making it (188 by 188).
I must have deleted that part of the question. My apologies.

Roger Stafford
Roger Stafford 2013-8-4
编辑:Roger Stafford 2013-8-4
M = M(10:10:end,10:10:end);

Cedric
Cedric 2013-8-4
buffer = M(:,1:10:end) ;
M_reduced = buffer(1:10:end,:) ;
  1 个评论
Sausan Khomusi
Sausan Khomusi 2013-8-4
thank you again Cedric. This worked perfectly. I was creating a for loop and it was getting really messy.
Sausan

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by