필터 지우기
필터 지우기

How do I manipulate specific elements in a cell array?

조회 수: 2 (최근 30일)
Janna Hinchliff
Janna Hinchliff 2018년 12월 10일
댓글: madhan ravi 2018년 12월 10일
I have written a code that gives me a cell array containing several cells with the same dimensions, e.g.
cellarray = {6x2 double} {6x2 double} {6x2 double}
I want to change these such that the first row of each cell is entered into a single array, i.e. the first row of the first cell becomes the first row of a new array, the first row of the second cell becomes the second row of the same new array and the first row of the third cell becomes the third row of the new array. Then the second row of the first cell is entered into a separate new array, with the second row of the second and third cell and so on. How can I achieve this?

채택된 답변

madhan ravi
madhan ravi 2018년 12월 10일
cell2mat(cellarray)
  댓글 수: 2
Janna Hinchliff
Janna Hinchliff 2018년 12월 10일
Does that just give each cell lined up next to the next as a matrix? By that I mean is each cell just written out in matrix form in the position it was in originally? It's quite difficult to tell in my full data set.
madhan ravi
madhan ravi 2018년 12월 10일
Try the below example:
c={[1:3;4 5 6].' [7:9; 10 11 12].' [13:15;16 17 18].'};
d=[c{:}]
cell2mat(c)

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

추가 답변 (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