How to replace some elements of matrix with zero

1 Ansicht (letzte 30 Tage)
Fateme Jalali
Fateme Jalali am 10 Feb. 2016
Kommentiert: Image Analyst am 10 Feb. 2016
Hello,I have a matrix of data with size 1*256 called hh2. I found local peaks using [pks loc]=findpeaks(hh2);Now in my matrix I want to put zero instead of all elements except local peaks that I found.can any one help me plz?
[pks,loc] = findpeaks(hh2);

Antworten (1)

the cyclist
the cyclist am 10 Feb. 2016
notPeakLoc = setxor(loc,1:256);
hh2(notPeakLoc) = 0;
  2 Kommentare
Fateme Jalali
Fateme Jalali am 10 Feb. 2016
thank you so much
Image Analyst
Image Analyst am 10 Feb. 2016
Maybe you could Vote for and Accept his answer to give him "credit" (reputation points) for it.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by