let small numbers in Matrix be zero

Hello, I would like a function that:
example A=[100,16; 5,10]
I would like to make a function f with a threshold=15 such that f(A)=[100,16;0,0]
i.e. all the number below threshold become zero
Any idea? Thank you!

 採用された回答

Sean de Wolski
Sean de Wolski 2013 年 5 月 1 日

5 投票

A(A<15) = 0;
Use logical indexing.

2 件のコメント

Tiger
Tiger 2013 年 5 月 1 日
Thank you, Sean! Your reply is so fast
Milena Telecka
Milena Telecka 2020 年 4 月 22 日
Great!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by