how to concatenate the cell data into a single matrix?

조회 수: 3 (최근 30일)
SHRESTH GUPTA
SHRESTH GUPTA 2021년 1월 27일
댓글: SHRESTH GUPTA 2021년 1월 29일
All the data samples are of same length. i need to create a matrix containing all this data. there are 327 cells like this in continuation.
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 1월 27일
What size of output are you looking for? (3*328) by 256? Or 3 x (256*328) ? Or 3 x 256 x 328 ? Or a single vector?
SHRESTH GUPTA
SHRESTH GUPTA 2021년 1월 27일
편집: SHRESTH GUPTA 2021년 1월 27일
I need a single matrix with all data of cells i.e 3*256 arranged as coulmn wise i.e (256*3) for all 327 cells. so that finally i will end up with the dimension of (256*3)*327

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 28일
Single_Matrix = cell2mat(cellfun(@(C) C(:), YourCell, 'uniform', 0));
However, I am concerned about whether this will work. You said twice that you have 327 cells, but your header shows that you have a 1 x 328 cell array. Is one of the cells empty and that is why you say 327 ? If so then what do you want done about the empty cell?
  댓글 수: 4
Walter Roberson
Walter Roberson 2021년 1월 28일
Single_Matrix = cell2mat(cellfun(@(C) C(:), Interpolated_data(1:327), 'uniform', 0));
SHRESTH GUPTA
SHRESTH GUPTA 2021년 1월 29일
THANK YOU SO MUCH WALTER SIR!!

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

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