if true statement matlab code example
Example 1: matlab if statement
if r == c
A(r,c) = 2;
elseif abs(r-c) ~= 1
A(r,c) = -1;
else
A(r,c) = 0;
end
Example 2: matlab if not true
~A
% or you can use:
not(A)
% in more complex statements, such as if's:
if ~(condition)
% logic
end