concatenating elements of cell

2 views (last 30 days)
NAVNEET NAYAN
NAVNEET NAYAN on 30 Sep 2021
Answered: Bryant Lash on 30 Sep 2021
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

Accepted Answer

Bryant Lash
Bryant Lash on 30 Sep 2021
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};

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!