Padding a cell array?

11 vues (au cours des 30 derniers jours)
L'O.G.
L'O.G. le 28 Nov 2022
Réponse apportée : Voss le 28 Nov 2022
How do you pad every other element of a cell array with a blank value thereby doubling the length of the cell?

Réponse acceptée

Voss
Voss le 28 Nov 2022
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}

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by