Delete n elements of every 10 elements in string vector

2 ビュー (過去 30 日間)
Elijah L
Elijah L 2022 年 3 月 24 日
コメント済み: Jan 2022 年 3 月 24 日
I have a string vector 1x570, I would like to keep the first element of every 10 elements of the string, but delete the rest. I know that this code doesn't work, but is there something close to it that would operate as desired?
Names = 1x570 string
ReName = Names(1:(2:10):end);
Basically, if I have a 1x570 string vector: [ A1a A1b A1c A1d A1e A1f A1g A1h A1i A1j A2a A2b ........ A570j ] (not the actual names)
I would like a reshaped vector that is 1x57: [ A1a A2a A3a A4a .......A57a ]

回答 (1 件)

Voss
Voss 2022 年 3 月 24 日
Does this do it?
ReName = Names(1:10:end)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by