Changing a string to a number

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.

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 5 Feb. 2014

0 Stimmen

A={1 2 'N/A';3 'B' 5;'N/A' 0 0} %Example
A(strcmp(A,'N/A'))={0}

2 Kommentare

Jason
Jason am 6 Feb. 2014
Thanks, this got me part of the way there, but it doesn't work for tables.
Azzi Abdelmalek
Azzi Abdelmalek am 6 Feb. 2014
Please post an example

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 5 Feb. 2014

Kommentiert:

am 6 Feb. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by