关于#matlab#的问题:我最近刚学matlab,写了一串代码但是运行效果不对

我最近刚学matlab,遇到了这样一题,写了一串代码但是运行效果不对,不知道问题出在哪儿,请各位指点

img

a=('The temperature in degrees Fahrenheit: ')
f=input(a);
n=isempty(f);
while n==0
    c=(f-32)*5/9;
    disp(c)
    a=('The temperature in degrees Fahrenheit: ')
    f=input(a);
    n=isempty(f);
    while n==1
        disp('error')
        break;
    end
end
while n==1
    disp('error')
end

把你最后的while循环删掉, 或者while 改成 if... 虽然我觉得没有输入就可以结束了,没有report error的必要....

while n==1
    disp('error')
end