operation with logical array
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Dyuman Joshi
le 4 Sep 2023
Modifié(e) : Dyuman Joshi
le 4 Sep 2023
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!