Undoing a strsplit function

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

3 件のコメント

Scott MacKenzie
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
Walter Roberson 2021 年 4 月 23 日
strjoin()
Edward Jia Sheng Lim
Edward Jia Sheng Lim 2021 年 4 月 24 日
thanks a lot walter. thats the function i used and it worked perfectly

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2021 年 4 月 23 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2021 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by