cell array to matrix

조회 수: 4 (최근 30일)
Busy Bee
Busy Bee 2018년 2월 4일
댓글: Busy Bee 2018년 2월 4일
I have a cell array with 4 elements.Each with 2*2 dimensions. I want to create an 8*2 matrix with these cell arrays. I can do it as p_all=[p{1};p{2};p{3};p{4}] but it will be in a loop and I will not the know the number of elements beforehand although all the elements will be 2*2. Any suggestions?
p{1} =
89 62
89 166
p{2} =
132 167
132 208
p{3} =
113 208
113 281
p{4} =
64 281
64 320

채택된 답변

Stephen23
Stephen23 2018년 2월 4일
편집: Stephen23 2018년 2월 4일
Assuming that the sizes are compatible you can easily use a comma-separated list:
vertcat(p{:})
  댓글 수: 1
Busy Bee
Busy Bee 2018년 2월 4일
yes. That worked. Thank you!

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by