Filter löschen
Filter löschen

Transform a cell of arrays to a table?

1 Ansicht (letzte 30 Tage)
Iris Li
Iris Li am 15 Mai 2018
Kommentiert: Iris Li am 15 Mai 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 Kommentare
Iris Li
Iris Li am 15 Mai 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 am 15 Mai 2018
Sorry I modified the codes in this question just now. Hopefully you'll find it more clear haha.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 15 Mai 2018
  2 Kommentare
Guillaume
Guillaume am 15 Mai 2018
Bearbeitet: Guillaume am 15 Mai 2018
or
B = vertcat(A{:});
Saves on a ctranspose.
Iris Li
Iris Li am 15 Mai 2018
Thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by