フィルターのクリア

Replacing non-integer values

6 ビュー (過去 30 日間)
Muneer
Muneer 2013 年 12 月 6 日
コメント済み: sixwwwwww 2013 年 12 月 6 日
I have an array of all numeric values but it is a mix of integers and non-integers. How could I replace an non-integer with 0, for example? Also, the array is fairly large (about 130k rows).
Thanks in advance!

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 6 日
a(ceil(a)~=a)=0

sixwwwwww
sixwwwwww 2013 年 12 月 6 日
編集済み: sixwwwwww 2013 年 12 月 6 日
If 'a' is your array then use the following:
a(arrayfun(@(x) ~isinteger(x), a)) = 0;
  8 件のコメント
Muneer
Muneer 2013 年 12 月 6 日
Thanks, it works great!
sixwwwwww
sixwwwwww 2013 年 12 月 6 日
you are welcome

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by