Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR MATLAB

if statement in matlab

for c = 1:ncols
    for r = 1:nrows
        
        if r == c
            A(r,c) = 2;
        elseif abs(r-c) == 1
            A(r,c) = -1;
        else
            A(r,c) = 0;
        end
        
    end
end
A
Source by in.mathworks.com #
 
PREVIOUS NEXT
Tagged: #statement #matlab
ADD COMMENT
Topic
Name
4+7 =