Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do I extract certain characters using for loop?

2 visualizaciones (últimos 30 días)
Jake
Jake el 10 de Abr. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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?

Respuestas (1)

PT
PT el 10 de Abr. de 2013
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

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by