How to duplicate columns in a cell array based on different values in last row
Show older comments
If I have a 4x2 cell array, D, which is equal to the following...
'2' '2'
'01346' '01347'
'P' 'P'
'62 63 71' '64 66'
How do I repeat the columns and split up the last row of the columns, like so...
'2' '2' '2' '2' '2'
'01346' '01346' '01346' '01347' '01347'
'P' 'P' 'P' 'P' 'P'
'62' '63' '71' '64' '66'
Any help and input would be helpful and greatly appreciated. I haven't written any specific code, but I was thinking along the lines of splitting the string of the last cells first and then trying to duplicate the columns, but I was unsure of how exactly to proceed. Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Multidimensional 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!