Changing a string to a number

1 vue (au cours des 30 derniers jours)
Jason
Jason le 5 Fév 2014
Commenté : Azzi Abdelmalek le 6 Fév 2014
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.

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 5 Fév 2014
A={1 2 'N/A';3 'B' 5;'N/A' 0 0} %Example
A(strcmp(A,'N/A'))={0}
  2 commentaires
Jason
Jason le 6 Fév 2014
Thanks, this got me part of the way there, but it doesn't work for tables.
Azzi Abdelmalek
Azzi Abdelmalek le 6 Fév 2014
Please post an example

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by