How to remove vectors values with restraints?

1 次查看(过去 30 天)
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