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

3 ビュー (過去 30 日間)
eman baky
eman baky 2021 年 9 月 16 日
コメント済み: eman baky 2021 年 9 月 17 日
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'

採用された回答

Voss
Voss 2021 年 9 月 16 日
B(end+1:numel(A)) = {'0'};

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by