Addition of two unequal matrices

3 Ansichten (letzte 30 Tage)
adnan saeed
adnan saeed am 9 Okt. 2018
Kommentiert: M am 10 Okt. 2018
I have two matrices of binary variables, e.g A = [1 0;1 1;0 1] and B = [1;0;1].My first question is how to add these matrices, and the other question is I want to apply this statement on the result: A + B <=1. Thanks
  3 Kommentare
adnan saeed
adnan saeed am 10 Okt. 2018
I know, but I want to add zeros to the the remaining position and add these two matrices.
M
M am 10 Okt. 2018
add zeros to the the remaining position
Can you explain what you mean exactly?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 9 Okt. 2018
A = [1 0;1 1;0 1]
B = [1;0;1]
idx = A+B<=1

M
M am 9 Okt. 2018
Bearbeitet: M am 9 Okt. 2018
You cannot compute A+B. You can only compute the sum for each column:
A+B
ans =
2 1
1 1
1 2

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by