Effacer les filtres
Effacer les filtres

Matrix Resize Rows and Cols

5 vues (au cours des 30 derniers jours)
Amanda
Amanda le 30 Août 2012
I have imported data as a matrix called A with a size
48 x 52 (48 Rows X 52 Columns).
How do I RESIZE the matrix to 48 X 48?
Thanks,
Amanda

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 30 Août 2012
Modifié(e) : Andrei Bobrov le 30 Août 2012
A - your matrix (48x52)
Anew = zeros(48,48); % new matrix with size 48x48
s = size(A);
for jj = 1:s(1)
Anew(jj,:) = interp1(1:s(2),A(jj,:),linspace(1,s(2),size(A2,2)));
end
  1 commentaire
Amanda
Amanda le 30 Août 2012
Thanks for your help. It is finally working.

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 30 Août 2012
imresize(A, [48 48])

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by