How do you insert a row or a column into a cell array?
205 次查看(过去 30 天)
显示 更早的评论
Dear Matlab community
I want to insert a row or a column into a cell array. How could I conduct that?
Best regards
Benjamin
0 个评论
采纳的回答
dpb
2022-10-9
No differently than with any other array -- although inserting in the middle somewhere requires copying (although with cell arrays, the actual data won't be copied)
c={rand(2),rand(2)} % create starting cell array
c=[c(1) {rand(4,2)} c(2)] % insert a new cell in the middle
NB: The cell array c itself must remain rectangular; as demonstrated the content in a cell can be anything. This with the orginal row vector can only insert a single row; with a 2D array will have to insert content for all rows/columns, etc., ...
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!