if,switch,for语句用法
%if else
a=2
if a==1
    b=0
else
    b=1
end
%switch-case
switch a
    case 1
        c=0
    otherwise
        c=1
end
%for循环
d=0
for i=1:3
    d=d+1
    if d==2
        e=1
        return
    end
    
end微信扫一扫
if,switch,for语句用法
%if else
a=2
if a==1
    b=0
else
    b=1
end
%switch-case
switch a
    case 1
        c=0
    otherwise
        c=1
end
%for循环
d=0
for i=1:3
    d=d+1
    if d==2
        e=1
        return
    end
    
end相关推荐