shrinking characters with condition

1 visualización (últimos 30 días)
Mohamuud hassan
Mohamuud hassan el 22 de Mayo de 2015
Editada: James Tursa el 22 de Mayo de 2015
hello all; i have limit of 1200 letters, i want to check first, if entering text is less then 250 then don't shrink and direct process it, but if it greater then 250 shrink that into groups and process first 250
  1 comentario
Star Strider
Star Strider el 22 de Mayo de 2015
How do you define a ‘group’? If a ‘group’ is a word, how do you decide what to keep?

Iniciar sesión para comentar.

Respuesta aceptada

James Tursa
James Tursa el 22 de Mayo de 2015
Editada: James Tursa el 22 de Mayo de 2015
E.g., using a for loop to subdivide the entered text string into groups of 250 characters each (is that what you want?):
n = numel(entered_text);
for k=1:250:n
process_text = entered_text(k:min(k+249,n));
% process the string in process_text
end

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by