Transposing Blocks of Rows in a Cell Array

6 views (last 30 days)

I have a cell array that consists of both numeric and non-numeric data. I want to transpose it in a certain way. That is, I want to take the first 43 rows and transpose those first, then I want to transpose the next 43 rows and place them under the first 43 rows and so on (in total, I have a collection of 202 groups of 43 rows). So, exactly what is being done in this question here:

https://au.mathworks.com/matlabcentral/answers/73483-transposing-blocks-of-matrices-from-a-bigger-initial-matrix

I have tried the code recommended there, but because my cell array is not only numeric data, the cell2mat and mat2cell commands don't work well.

Accepted Answer

Guillaume
Guillaume on 19 Apr 2018
newcellarray = num2cell(reshape(yourcellarray.', size(yourcellarray, 2), 43, []), [1 2]); 
newcellarray = vertcat(newcellarray{:})

More Answers (0)

Categories

Find more on Cell Arrays 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!