How to add zeros to the end of a cell of array

6 vues (au cours des 30 derniers jours)
eman baky
eman baky le 16 Sep 2021
Commenté : eman baky le 17 Sep 2021
plz help
I have two arrays like A={'ATG' 'TCG' 'ATC' 'TTC' 'ACC' 'CCC' 'ACC' 'AAC' 'CAG' 'ACC'}; & B= {'T' '0' '0' 'G' 'G'};
In 'A', I have 10 elements(say m) and in 'B', I have 5(say n) elements. I need to add 10-5=5 (m-n) zeros to the end of B.
I used this
B{numel(A)} = '0'
but the result is 'T' '0' '0' 'G' 'G' [] [] [] [] '0'
i wanna the result 'T' '0' '0' 'G' 'G' '0' '0' '0' '0' '0'

Réponse acceptée

Voss
Voss le 16 Sep 2021
B(end+1:numel(A)) = {'0'};

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by