필터 지우기
필터 지우기

How to Unnest Nested cell arrays

조회 수: 17 (최근 30일)
xander fong
xander fong 2015년 7월 29일
편집: Stephen23 2015년 7월 29일
Hello, I have a 17x300 cell array, some of which contain text and numbers. However, the 17th column is filled with 1x1 cell arrays with a number inside. How do I unnest these unnested cells?
  댓글 수: 1
Stephen23
Stephen23 2015년 7월 29일
편집: Stephen23 2015년 7월 29일
In MATLAB, like in all mathematics, the first dimension is always the rows, and the second dimension is the columns. So your "17x300" means seventeen rows and three hundred columns... yet your question is about the "17th column", which implies that you meant the size to be 300*17 (three hundred rows and seventeen columns).

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

채택된 답변

Stephen23
Stephen23 2015년 7월 29일
편집: Stephen23 2015년 7월 29일
Given your array X:
X(:,17) = vertcat(X{:,17});
Note that this will only work if all of the cells in that column contain cell arrays. It will cause an error if any cell in the column contains any other data type.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by