String to txt file with each value in a new line

4 ビュー (過去 30 日間)
Abdul Ghani Zahid
Abdul Ghani Zahid 2020 年 4 月 25 日
回答済み: Pavel Osipov 2020 年 4 月 25 日
I have a sring in which different binary values are seperated by spaces. I want export this data in a TXT file. but I want each value to be printed on a new line in the txt file.
for example the string I have is
' 00000110000000110101010011111111 00000110001111100001100001110011 00000110010000000011001110100100 00000110000100110100101111011101 '
and I want it in the txt file as
00000110000000110101010011111111
00000110001111100001100001110011
00000110010000000011001110100100
00000110000100110100101111011101

回答 (1 件)

Pavel Osipov
Pavel Osipov 2020 年 4 月 25 日
Hi.
1) If there are always the same number of spaces, then in MATLAB Editor - "Find and Replace" we change the Spaces to "; " - get the column and its-in .txt
2) If the number of spaces can be different, change the first of the series of spaces to ";", MATLAB should again give the column without taking into account the other spaces. I can't check now-r20a reinstalling. I.E. 2) = 1) :))
3) If you need to do automatic processing of some file name.m, then write a function to replace the space code = #32 with CR = #13 . Try it, I'll put MATLAB - I'll do it.
Good luck!

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by