How to remove vectors values with restraints?

조회 수: 1 (최근 30일)
Antonio Alves
Antonio Alves 2021년 4월 5일
답변: David Fletcher 2021년 4월 5일
I'm with two distinct vectors that shouldn't have, in the same column, values that would sum up to >=1.
Ex:
A = [ 0.1 0.2 0.4 0.6]
B = [ 0.5 0.9 0.6 0.2]
Since 0.2 + 0.9 = 1.1 and 0.4 + 0.6 = 1, what I would need is a code that would turn this set of vectors into:
A = [ 0.1 0.6] B = [0.5 0.2]
How can I do that? I have no clue where to start

답변 (1개)

David Fletcher
David Fletcher 2021년 4월 5일
A = [ 0.1 0.2 0.4 0.6]
B = [ 0.5 0.9 0.6 0.2]
C=(A+B)<1
A=A(C)
B=B(C)
C =
1×4 logical array
1 0 0 1
A =
0.1000 0.6000
B =
0.5000 0.2000

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by