Matlab App Erroneously detecting infinite loop
Ältere Kommentare anzeigen
Hello Gurus,
I have a matlab application that acts as a wrapper to Simulink Test. Some of the Tests can take a very long time to run, I'm talking several hours. When I run one of these tests that involves many iterations the application closes down during the activity. As the data for simulink test is actually loaded on to the Tree I use to display the tests this means that the next Test fails. The weird thing is I can run hundreds of single iteration tests without issue and the issue does not have anything to do with a license I think as I selected to borrow a license for the whole day just in case. The app gives me no errors or warnings it just closes itself down on the long running iterations. Any ideas/ tips appreciated.
Cheers
Richard
1 Kommentar
Richard Good
am 28 Sep. 2022
Antworten (1)
Eric Delgado
am 30 Sep. 2022
Bearbeitet: Eric Delgado
am 30 Sep. 2022
It sounds like a limitation of the foor loops. For example, if you create e for loop from 1 to a BigNumberAlmostInfinite you will receive the warning "Too many FOR loop iterations. Stopping after 9223372036854775806 iterations."
Just replace it for while loops.
% Instead of:
for ii = 1:BigNumberAlmostInfinite
% code
end
% Do:
ii = 0;
while true
ii = ii+1;
% code
if ii == BigNumberAlmostInfinite
break
end
end
2 Kommentare
Richard Good
am 6 Okt. 2022
Eric Delgado
am 6 Okt. 2022
Even though you said that the app shows no error or warning messages, did you try to protect your code with a try/catch block?
for ii = 1:BigNumberAlmostInfinite
try
% code
catch ME
% put a break point in here and share the info of ME
end
end
Kategorien
Mehr zu Test Model Components finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!