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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by