same number in the vector

조회 수: 1 (최근 30일)
Hussein Qenawy
Hussein Qenawy 2021년 11월 27일
댓글: Chunru 2021년 11월 27일
I want to use all the same number in the vector for one equation and another numbers for another equaion
ex: my vecotr is h=[0.12;0.1;0.1;0.04;0.04;0.04;0.1;0.1;0.1;0.06;0.1]
here 0.1 repeated 5 times and 0.04 3 times ..i want to use these numbers for one eq and another for another eq
thanks

채택된 답변

Chunru
Chunru 2021년 11월 27일
편집: Chunru 2021년 11월 27일
h=[0.12;0.1;0.1;0.04;0.04;0.04;0.1;0.1;0.1;0.06;0.1]
h = 11×1
0.1200 0.1000 0.1000 0.0400 0.0400 0.0400 0.1000 0.1000 0.1000 0.0600
hu = unique(h);
idx = sum(h -hu' == 0) > 1;
hrep = hu(idx)
hrep = 2×1
0.0400 0.1000
  댓글 수: 2
Hussein Qenawy
Hussein Qenawy 2021년 11월 27일
but 0.12 and 0.06 not repeated ...thanks
Chunru
Chunru 2021년 11월 27일
See the updated.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by