Problem 17. Find all elements less than 0 or greater than 10 and replace them with NaN
1 回表示 (過去 30 日間)
古いコメントを表示
i don't know what wrong with my code its very frustating really
( ̄へ ̄)
here my code:
function y = cleanUp(x)
u=find(x<0 | x>10);
x(u)='NaN';
y = x;
end
0 件のコメント
採用された回答
per isakson
2013 年 7 月 14 日
編集済み: per isakson
2013 年 7 月 14 日
Should be
x(u) = NaN;
without blips. What did the error message say?
3 件のコメント
Image Analyst
2013 年 7 月 14 日
Yes they're different. NaN is a special object with special meaning. 'NaN' is a 3 byte character array that has no special meaning whatsoever. It just happens to have those characters in it but it has no relation to the real, special NaN object whatsoever.
Jan
2013 年 7 月 14 日
@Image Analyst: To be nit-picking: 'NaN' is a 3 character array. But a char uses 2 bytes, such that 'NaN' has 6 bytes.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!