how can I eliminate space between characters of a string?

12 ビュー (過去 30 日間)
tina jain
tina jain 2015 年 5 月 11 日
回答済み: Guillaume 2015 年 5 月 11 日
e.g. let my string is this t P t P t P t P t P t P t P t P t P t How to convert this string with no white spaces t P t P t P t P t P t P t P t P t P t --->tptptptptptptptptptpt

採用された回答

Guillaume
Guillaume 2015 年 5 月 11 日
Either use strrep or plain matrix element comparison and deletion:
s = 't P t P t P t P t P t P t P t P t P t';
%option 1, strrep:
s1 = strrep(s, ' ', '')
%option 2, comparison and deletion
s2 = s; s2(s2 == ' ') = []

その他の回答 (0 件)

カテゴリ

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