Undoing a strsplit function

is there a way to reverse the strsplit at the end of a loop?

3 comentarios

Scott MacKenzie
Scott MacKenzie el 23 de Abr. de 2021
Editada: Scott MacKenzie el 23 de Abr. de 2021
What do you mean by "end of a loop"? What loop? If you just want to reverse the order of the elements produced by strsplit, use flip:
>> s = 'a,bc,def,g'
s =
'a,bc,def,g'
>> z = strsplit(s,',')
z =
1×4 cell array
{'a'} {'bc'} {'def'} {'g'}
>> flip(z)
ans =
1×4 cell array
{'g'} {'def'} {'bc'} {'a'}
Walter Roberson
Walter Roberson el 23 de Abr. de 2021
strjoin()
Edward Jia Sheng Lim
Edward Jia Sheng Lim el 24 de Abr. de 2021
thanks a lot walter. thats the function i used and it worked perfectly

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 23 de Abr. de 2021

0 votos

The easiest way is to store a copy of the original data. Then nothing has to be undone.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Abr. de 2021

Comentada:

el 24 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by