Making Matrix Dimensions Equal

Hey,
I have this cell with 12 different matrix. They are all of different size in length. How can I make all of them equal to 501 x 53 in size.

5 comentarios

Guillaume
Guillaume el 28 de Oct. de 2019
So what should happen to the larger matrices? Remove columns at random?
Hinna Ahmed
Hinna Ahmed el 28 de Oct. de 2019
yes the other columns can be removed/deleted.
Guillaume
Guillaume el 28 de Oct. de 2019
Which other columns? Pick them at random? The first ones? the last ones? Some other criteria?
Hinna Ahmed
Hinna Ahmed el 28 de Oct. de 2019
the last ones
Hinna Ahmed
Hinna Ahmed el 28 de Oct. de 2019
for instances, the matrix in the first row has a size of 501 x 55, so to chnage its size to 501 x 53, column 54 and 55 should be deleated.

Iniciar sesión para comentar.

 Respuesta aceptada

Guillaume
Guillaume el 28 de Oct. de 2019
smallestwidth = min(cellfun('size', yourcellarray, 2)); %smallest width of all matrices in the cell array
newcellarray = cellfun(@(m) m(:, 1:smallestwidth), yourcellarray, 'UniformOutput', false); %crop all matrices inside the cell array to the smallest width

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Oct. de 2019

Comentada:

el 28 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by