operation with logical array
조회 수: 1 (최근 30일)
이전 댓글 표시
c=[0 0 0 0]
a=[1 0 1 0]
b=[0 1 1 0]
b-a
c(find((b-a)>0))=1
if element a==0 and element b==1 i want to change element c in =1
Anyone can me suggest a best method to do this
댓글 수: 0
채택된 답변
Dyuman Joshi
2023년 9월 4일
편집: Dyuman Joshi
2023년 9월 4일
c=[0 0 0 0];
a=[1 0 1 0];
b=[0 1 1 0];
c = (a==0)&(b==1)
%simplified
c = (~a)&b
Given the questions you have asked recently, I would strongly recommend you to take the free MATLAB Onramp tutorial to learn the essentials of MATLAB.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!