Executing the body of IF statement.
Afficher commentaires plus anciens
Hi,
Why MATLAB is not executing the body of the following selection if statement eventhough I believe the condition is true? Your help would be appreciated!
Note: members is a 1by 3 cell. attack = 5, n1=7

for ii=1:n1 % Check if neighboring nodes will survive the cascading failure or not
if ~ismember(ii,members{1}) && ~ii==attack
A(ii,:)=0;
A(:,ii)=0;
C(ii,:)=0; % All nodes in Layer B coupled to neighboring nodes will get failed
C(:,ii)=0;
end
end
3 commentaires
Ameer Hamza
le 12 Oct 2020
Unfortunately, believing is not enough. Add breakpoint at the line of if statement and check why the condition remains false. https://www.mathworks.com/help/matlab/matlab_prog/set-breakpoints.html
Waseem AL Aqqad
le 12 Oct 2020
Waseem AL Aqqad
le 12 Oct 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Multidimensional Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!