How can I fix this infinite loop?
Afficher commentaires plus anciens
C = input('Enter a vector of coefficients for an odd-order polynomial: ');
valC = length(C);
count = 1;
while mod(valC,2) == 1
C = input('Try Again. Enter a vector of coefficients for an odd-order polynomial: ');
count = count + 1;
if count > 4
warning('Odd number of coefficients entered. Last element of user input removed.');
C(:,end) = [];
end
end
When the count variable reaches 5 I just want to produce the warning and remove the last number from the C array but when I run it, MATLAB produces the warning and removes the variable however it just starts the loop over again instead of ending after the last number in C array is removed.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Filter Design dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!