How to detect any unsupported character other than number
1 回表示 (過去 30 日間)
古いコメントを表示
I have series of data in my excel file. But there are some unsupported characters present in the file like 1 0, 0h0,0.>68,1L1 etc. I want to detect all of these using regular expression or any method and replace it by zero. My main moto is detect anything which is not a number and replace it by zero.
0 件のコメント
回答 (1 件)
Walter Roberson
2012 年 1 月 31 日
L(L < '0' | L > '9') = '0';
2 件のコメント
Walter Roberson
2012 年 2 月 6 日
L is the character string.
The code detects anything that is not a number and replaces it with 0.
The digits are all together as characters, in the order '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' . So anything less than '0' is not a digit and anything greater than '9' is not a digit.
参考
カテゴリ
Help Center および File Exchange で MATLAB Report Generator についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!