Borrar filtros
Borrar filtros

Decompose and invert a cell array

2 visualizaciones (últimos 30 días)
Viridiana  Torres
Viridiana Torres el 25 de Abr. de 2016
Respondida: Andrei Bobrov el 25 de Abr. de 2016
I have a cell array of 4*1 composed by number, this array looks like this:
A= [1 3 4 5 7]
[5 6 7 8]
[8 9 5]
I want to separate and invert its elements to obtain the next:
B=
1 5 8
3 6 9
4 7 5
5 8
7
All elements in B should be in its own ij position
Thanks for your help! Sincerely ViriT

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 25 de Abr. de 2016
A = {[1 3 4 5 7]
[5 6 7 8]
[8 9 5]};
m=cellfun(@numel,A);
B = cellfun(@(x)[x,nan(1,max(m)-numel(x))],A,'un',0);
B = cat(1,B{:})';

Más respuestas (0)

Categorías

Más información sobre Electrical Block Libraries en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by