Write sections of a long string as new lines in a text document
1 回表示 (過去 30 日間)
古いコメントを表示
I have a very long string value, approx. 13,000 characters long, that is made up of the letters X, Y and Z. So:
sub = 'XYZYXYZYZYZXYZYXYZ....'
and so on. Within the long string, there is also every so often a 0:
sub = '...X0Y...'
The 0 represents a break point. I need to write out this long sequence onto a single txt file, but at each instance where there is a '0', I need to remove that zero and start a new line on the text file.
How would I go about doing this?
0 件のコメント
採用された回答
その他の回答 (1 件)
Steven Lord
2022 年 1 月 18 日
sub = 'XYZYXYZYZYZXYZYXYZ0XYXYXYX';
sub2 = replace(sub, '0', newline)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!