Remove elements > 0 and < -1 from an array and replace them by 0

Hi, I have an array (7x269), as attached. I would like to remove all values (elements) >0 and <-1 and replace them by 0. Thanks

 Akzeptierte Antwort

madhan ravi
madhan ravi am 7 Nov. 2018
Bearbeitet: madhan ravi am 7 Nov. 2018
load data.mat
offsetfromPPT(offsetfromPPT<-1 | offsetfromPPT>0)=0
max(max(offsetfromPPT)) %if it is zero
min(min(offsetfromPPT)) %if it is less than -1 then the solution is right

4 Kommentare

if it is what you are looking for accept the answer else let know
Hi Madhan, Thanks for your answer. When I run this code, I get and ans 0 and ans -1
It worked. Thank you
Anytime :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Construct and Work with Object Arrays finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018b

Gefragt:

FL
am 7 Nov. 2018

Kommentiert:

am 7 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by