padcatcell

版本 1.110.0.0 (2.2 KB) 作者: Jos (10584)
concatenate cell arrays of unequal lengths
84.0 次下载
更新时间 2017/3/27

查看许可证

M = padcatcell(C1, C2, ..., CN} concatenates the cell arrays C1 through CN into one large cell array M. These cells do not have to have the same number of elements. M will have N rows and the k-th row will contain the elements of the k-th cell array. Shorter inputs will be padded with empty cells. Note that the cells are always concatenated along the first dimension (in contrast to PADCAT).

[M, TF] = padcatcell (...) will return a logical array TF with the same size as M. TF is true where M holds an element from the original input. This is usefull to replace the padded empty cells with something else.

Example:
A = {'apple','ball','cat'}
B = {} ; % empty
C = {'dog' ; 'egg'} % note the column orientation
[M, TF] = padcatcell(A, B, C)
M(~TF) = {'-'}

Note: the cells are not limited to cell array of strings, they can hold any type of element.
See also cat, padcat, nones, strvcat, group2cell, catstruct

引用格式

Jos (10584) (2025). padcatcell (https://www.mathworks.com/matlabcentral/fileexchange/62290-padcatcell), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2015a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Creating and Concatenating Matrices 的更多信息
致谢

参考作品: nones

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.110.0.0

file exchange title change

1.11.0.0

uploaded correct version 1.11

1.1.0.0

added note about cell array of strings

1.0.0.0