How to reduce an existing matrix

6 visualizzazioni (ultimi 30 giorni)
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 Commento
Azzi Abdelmalek
Azzi Abdelmalek il 4 Ago 2013
What do you mean by reduce? Please give a short example

Accedi per commentare.

Risposta accettata

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

Più risposte (3)

Sausan Khomusi
Sausan Khomusi il 4 Ago 2013
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 il 4 Ago 2013
Modificato: Roger Stafford il 4 Ago 2013
M = M(10:10:end,10:10:end);

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

Accedi per commentare.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by