필터 지우기
필터 지우기

Transform a cell of arrays to a table?

조회 수: 1 (최근 30일)
Iris Li
Iris Li 2018년 5월 15일
댓글: Iris Li 2018년 5월 15일
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
Iris Li
Iris Li 2018년 5월 15일
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 2018년 5월 15일
Sorry I modified the codes in this question just now. Hopefully you'll find it more clear haha.

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2018년 5월 15일
  댓글 수: 2
Guillaume
Guillaume 2018년 5월 15일
편집: Guillaume 2018년 5월 15일
or
B = vertcat(A{:});
Saves on a ctranspose.
Iris Li
Iris Li 2018년 5월 15일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by