Changing a string to a number

1 回表示 (過去 30 日間)
Jason
Jason 2014 年 2 月 5 日
コメント済み: Azzi Abdelmalek 2014 年 2 月 6 日
I have a table that contains both numerical values as well as text. I would like to replace the string 'N/A' to the number 0 in the table.
Thanks for helping out a true beginner.

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 5 日
A={1 2 'N/A';3 'B' 5;'N/A' 0 0} %Example
A(strcmp(A,'N/A'))={0}
  2 件のコメント
Jason
Jason 2014 年 2 月 6 日
Thanks, this got me part of the way there, but it doesn't work for tables.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 6 日
Please post an example

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

カテゴリ

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