MATLAB: How to transpose a cell array blockwise

Curve Fitting ToolboxMATLABMATLAB CompilerRF ToolboxsimulinkStatistics and Machine Learning ToolboxSymbolic Math Toolboxtranspose

I have created a dataset D with one column and 3 rows which includes the following elements:
D1 = {1, 1} , 'Text1' with a total repetition of 15 times (1 row and 15 columns)
D2 = {2, 1} , Includes 15 300×3 double elements (1 row and 15 columns) named data1
D3 = {3, 1} , 'Text2' with a total repetition of 15 times (1 row and 15 columns)
Therefore I have the following cell array if i open D1, D2, and D3:
Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1
data1 data1 data1 data1 data1 data1 data1 data1 data1 data1 data1 data1 data1 data1 data1
Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2
When using the transpose option I would like to get the following order:
Text1
data1
Text2
Text1
data1
Text2
Text1
data1
Text2
etc.
However I am not sure how to write the code for it properly. Is there a matlba function to create "block elements" for transposing the above mentioned example?
Stay safe and healthy
David

Best Answer

E.g., brute force approach
result = reshape([D{1};D{2};D{3}],[],1);