How to reduce an existing matrix

조회 수: 6 (최근 30일)
Sausan Khomusi
Sausan Khomusi 2013년 8월 4일
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.
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 4일
What do you mean by reduce? Please give a short example

댓글을 달려면 로그인하십시오.

채택된 답변

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