Addition of two unequal matrices

조회 수: 2 (최근 30일)
adnan saeed
adnan saeed 2018년 10월 9일
댓글: M 2018년 10월 10일
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
adnan saeed
adnan saeed 2018년 10월 10일
I know, but I want to add zeros to the the remaining position and add these two matrices.
M
M 2018년 10월 10일
add zeros to the the remaining position
Can you explain what you mean exactly?

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

답변 (2개)

KSSV
KSSV 2018년 10월 9일
A = [1 0;1 1;0 1]
B = [1;0;1]
idx = A+B<=1

M
M 2018년 10월 9일
편집: M 2018년 10월 9일
You cannot compute A+B. You can only compute the sum for each column:
A+B
ans =
2 1
1 1
1 2

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by