Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do I extract certain characters using for loop?

3 ビュー (過去 30 日間)
Jake
Jake 2013 年 4 月 10 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I need to extract 5 letters at a time from an input to go through a for loop. Such as if the input was 15 letters, how do I run the first five, next five, and last five at a time through for loop?

回答 (1 件)

PT
PT 2013 年 4 月 10 日
You define the loop index to increase by 5, instead of by 1.
a = 'ABCDEFGHIJKLMNO';
for i = 1:5:length(a)
b = a(i:i+4);
disp(b);
end

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by