简体   繁体   中英

Do While Loops in Matlab

I want to use a do while loop in Matlab:

I am currently using this code, but I don't think that I am doing it right:

flag2=true;

while (flag2)

    % (I write the program here)

    for abc = 1:3
        if abs(error(abc)) < errorTreshold
            flag2=false;
            break
        end
    end
end

You must do:

if abs(error(abc)) > errorTreshold  

instead of "<"

or see if you can do (removing the 'if'):

while abs(error(abc))>errorTreshold

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM