concatenating elements of cell

조회 수: 1 (최근 30일)
NAVNEET NAYAN
NAVNEET NAYAN 2021년 9월 30일
답변: Bryant Lash 2021년 9월 30일
I have a data in 300-by-1 cells and each cell contains 500-by-1 single value. How can I make it 1) two 150-by-500 matrix containing these single values and place in 2 cells and 2) a cell containing 300-by-500 single values?
I am able to concatenate 3 or 4 cells manually, but how can I do it for 300 cells?
In case, you have any query feel free to comment

채택된 답변

Bryant Lash
Bryant Lash 2021년 9월 30일
If you want to do it in a pretty brutish way you can do this
[cellData{300,1}] = [1:500]'; %initialize cellData
matrixedData = [cellData{:}]'; %gives you a 300X500
problem1mat1 = matrixedData(1:150,:);
problem1mat2 = matrixedData(151:300,:);
problem2 = {matrixedData};

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