Removing unrecognised characters and superfluous data from a string

32 ビュー (過去 30 日間)
Duncan
Duncan 2019 年 7 月 16 日
コメント済み: dpb 2019 年 7 月 17 日
I have a set of data I have imported as a string, however when it is imported it fills in blank rows with arrow characters, as shown below:
NC(N)=N→59.0717→C→"5N3→-1.71840001642704→0.022000011056661606→75.89000129699707"→→→→→→→→→→→→"
"→→→→→→→→→→→→→"
"OC(=O)CCC(O)=O→118.08764→C4→"6O4→-0.6665999889373779→-0.4739999994635582→74.5999984741211"→→→→→→→→→→→→"
"→→→→→→→→→→→→→"
"CC(=O)NC1=CC=C(O)C=C1→151.16446→C8→"9NO2→1.0175999999046325→-1.6619999147951603→49.32999897003174"→→→→→→→→→→→→"
"→→→→→→→→→→→→→"
"NC(N)=N→59.0717→C→"5N3→-1.71840001642704→0.022000011056661606→75.89000129699707"→→→→→→→→→→→→"
"→→→→→→→→→→→→→"
I can't remove these by the method I would normally use below:
Data(Data == "→→→→→→→→→→→→→") = []
In the original file they appear to be blank lines, in between the actual lines of text.
Is there a way to remove these?
  11 件のコメント
Stephen23
Stephen23 2019 年 7 月 16 日
@Duncan: the original file is an .xlsx file? If you actually copied that data from a website, can you please just give a link?
Duncan
Duncan 2019 年 7 月 17 日
@Stephen Cobeldick: I used this website to generate data from a set of data which I have also attached:

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

採用された回答

Yueyan Li
Yueyan Li 2019 年 7 月 17 日
編集済み: Yueyan Li 2019 年 7 月 17 日
That's not unrecognized data, it is tab, use sprintf('\t') to generate it.
please run:
replace(CrystalData(37),sprintf('\t'),'')
  1 件のコメント
dpb
dpb 2019 年 7 月 17 日
"use sprintf('\t') to generate it."
or
tab=char(9);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by