This is an if-else structure of a larger problem. I have simplified it down to the numerals in work here, but can't figure out where lies the problem.
when I evaluate this simple if structure, the program effortlessly outputs a value of "w=1", (The program enters the structure.)
if (1 > 0)&(3 <= 4)
w = 1;
end
But when I evaluate the same above structure inside an if, else if combination the program won't enter in the "elseif structure" for some reason, and only outputs "m=0", whereas I should also get "w=1". What am I doing wrong?
if (4 <= 4)& (3 <= 4)
m= 0;
elseif (1 > 0)&(3 <= 4)
w = 1;
end
Matlab always evaluates:
equals to logical 1. Why won't it then enter inside the if, else-if structure?
1 Comment
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/301181-where-is-the-problem-in-this-if-else-structure#comment_387624
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/301181-where-is-the-problem-in-this-if-else-structure#comment_387624
Sign in to comment.