Padding a cell array?

5 次查看(过去 30 天)
L'O.G.
L'O.G. 2022-11-28
回答: Voss 2022-11-28
How do you pad every other element of a cell array with a blank value thereby doubling the length of the cell?

采纳的回答

Voss
Voss 2022-11-28
Maybe something like this:
C = {1 2 3 4};
C_new = cell(1,2*numel(C));
C_new(1:2:end) = C
C_new = 1×8 cell array
{[1]} {0×0 double} {[2]} {0×0 double} {[3]} {0×0 double} {[4]} {0×0 double}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by