Borrar filtros
Borrar filtros

how can i combine arrays of different size.

8 visualizaciones (últimos 30 días)
zhoug zho
zhoug zho el 31 de Mayo de 2021
Respondida: Walter Roberson el 31 de Mayo de 2021
i have six arrays of size as given in figure.
i need to combine all arrays one after the other.
but the problem is they are of different dimenion.
how can i combine all these arrays?
thanks in advance.
  4 comentarios
zhoug zho
zhoug zho el 31 de Mayo de 2021
yes, pad with zeros.
zhoug zho
zhoug zho el 31 de Mayo de 2021
Editada: zhoug zho el 31 de Mayo de 2021
how can i combine these arrays by padding with NaN or zeros.?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 31 de Mayo de 2021
sizes = cell2mat(cellfun(@size, YourCell(:), 'uniform', 0));
maxcols = max(sizes(:,2));
combined = cell2mat(cellfun(@(M) [M, zeros(size(M,1), maxcols-size(M,2))], YourCell(:), 'uniform', 0));

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by