How to replace some elements of matrix with zero

조회 수: 1 (최근 30일)
Fateme Jalali
Fateme Jalali 2016년 2월 10일
댓글: Image Analyst 2016년 2월 10일
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);

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by