I have teh following cell array. Each cell is a row of 6 or 8 colmns.
I needed a it to put each cell array in one row and make it complete the rest of the cell with zeros ou NaN.
Like:
{ 1 2 3 4 5 6} ; {1 2 3 4 5 6 7 8} ; { 1 2 3 4 5 6}
1 2 3 4 5 6 0 0
1 2 3 4 5 6 7 8
1 2 3 4 5 6 0 0

 Respuesta aceptada

ANKUR KUMAR
ANKUR KUMAR el 15 de Mzo. de 2021

1 voto

out=zeros(length(result_pettitt),max(cellfun(@(x) length(x), result_pettitt)));
for kk=1:length(result_pettitt)
out(kk,1:length(result_pettitt{kk}))=cell2mat(result_pettitt{kk});
end

Más respuestas (0)

Categorías

Más información sobre Performance and Memory en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Mzo. de 2021

Comentada:

el 15 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by