create a cell array of N dimensions of type char
3 次查看(过去 30 天)
显示 更早的评论
As the title says,
How do i create a cell array of N dimensions of type char.
Thanks
0 个评论
回答(1 个)
Dave B
2021-7-29
编辑:Dave B
2021-7-29
A cell array has type cell, but you can use repelem/repmat to make a cell array where each cell contains an empty char:
If you want a cell array of size 1,n where each cell contains an empty char...
repelem({''},n)
Or for a cell of size m,n where each cell contains an empty char:
repmat({''},m,n)
For an n dimensional cell array, where the last dimension has a size>1, something like this:
sz=[1 2 3 4 5];
repmat({''},sz)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!