Borrar filtros
Borrar filtros

Transform a cell of arrays to a table?

1 visualización (últimos 30 días)
Iris Li
Iris Li el 15 de Mayo de 2018
Comentada: Iris Li el 15 de Mayo de 2018
How could I get B from A? Thanks!!! The cell2table command couldn't because the element in A is {[1;2;3]}, instead of {[1]},{[2]},{[3]}, which would make it a bit more complicated. I tried cell2table, cell2mat, struct2table...
A = {[1;2;3];[1;2;3];[1;2;3];[1;2;3]}
B = [1,2,3;1,2,3;1,2,3;1,2,3]
A =
4×1 cell array
[3×1 double]
[3×1 double]
[3×1 double]
[3×1 double]
B =
1 2 3
1 2 3
1 2 3
1 2 3
  3 comentarios
Iris Li
Iris Li el 15 de Mayo de 2018
I actually have the following function. Para is like A I mentioned in this question, a 4*1 cell. What I want to get is a 4*3 table.
G = findgroups(m,n);
func = @(x,y,z){[z,z.*x(:),z.*x(:).^2]\(z.*y(:))};
Para = splitapply(func,x,y,z,G);
Iris Li
Iris Li el 15 de Mayo de 2018
Sorry I modified the codes in this question just now. Hopefully you'll find it more clear haha.

Iniciar sesión para comentar.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 15 de Mayo de 2018
  2 comentarios
Guillaume
Guillaume el 15 de Mayo de 2018
Editada: Guillaume el 15 de Mayo de 2018
or
B = vertcat(A{:});
Saves on a ctranspose.
Iris Li
Iris Li el 15 de Mayo de 2018
Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Cell Arrays 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