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!

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 1 Mai 2013

5 Stimmen

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

2 Kommentare

Tiger
Tiger am 1 Mai 2013
Thank you, Sean! Your reply is so fast
Milena Telecka
Milena Telecka am 22 Apr. 2020
Great!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by