필터 지우기
필터 지우기

How to compare values in one vector?

조회 수: 2 (최근 30일)
huanghui shi
huanghui shi 2020년 4월 9일
답변: KSSV 2020년 4월 9일
for example B=[1,2,2,5,4,4]
so i only want output 1,5,i dont want 2,4 because they have same value in this vector.
how to do this within fop-loop?
  댓글 수: 1
BN
BN 2020년 4월 9일
You can use the unique function

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

답변 (1개)

KSSV
KSSV 2020년 4월 9일
a=[1,2,2,5,4,4];
xbins = unique(a);
[counts,centres] = hist(a,xbins);
iwant = a(counts==1)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by