Undoing a strsplit function
显示 更早的评论
is there a way to reverse the strsplit at the end of a loop?
3 个评论
Scott MacKenzie
2021-4-23
编辑:Scott MacKenzie
2021-4-23
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
2021-4-23
strjoin()
Edward Jia Sheng Lim
2021-4-24
回答(1 个)
Jan
2021-4-23
0 个投票
The easiest way is to store a copy of the original data. Then nothing has to be undone.
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!