How to separate numbers and text from a string

7 ビュー (過去 30 日間)
Venkatapathi
Venkatapathi 2014 年 1 月 28 日
コメント済み: Nader Virk 2022 年 2 月 25 日
Hello,
i have string variable s = 'x 5.67 y 7.789';
i would like to read only numbers from the string.
requesting you to help me, how to separate numbers and text from the string.
Thanks & Regards Venkatapathi.P

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 28 日
編集済み: Azzi Abdelmalek 2014 年 1 月 28 日
s = 'x 5.67 y 7.789'
out=str2double(regexp(s,'[\d.]+','match'))
  4 件のコメント
Bhupinder Saini
Bhupinder Saini 2018 年 9 月 5 日
How do you alter this to return the characters only in the string?
i.e. x.h y g j
Nader Virk
Nader Virk 2022 年 2 月 25 日
For string s, I appreciate if someone could help how to get only the chracters? Thanks!

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

その他の回答 (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