필터 지우기
필터 지우기

Matlab App Erroneously detecting infinite loop

조회 수: 7 (최근 30일)
Richard Good
Richard Good 2022년 9월 27일
댓글: Eric Delgado 2022년 10월 6일
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
Richard Good
Richard Good 2022년 9월 28일
I get this message in the window when the issue happens,
Error while evaluating DestroyedObject PrivatePushedButtonFcn
This is supposed to indicate an infinite loop I think, but I do not have an infinite loop, it just takes a long time sometimes. I have a for loop with 5 further for loops inside it to iterate over my simulink tests the way I want. I think Matlab has erroneously detected an infinite loop. How do I get over this/ switch off that check?

댓글을 달려면 로그인하십시오.

답변 (1개)

Eric Delgado
Eric Delgado 2022년 9월 30일
편집: Eric Delgado 2022년 9월 30일
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
Richard Good
Richard Good 2022년 10월 6일
Hi Eric,
Thanks for your reply, but I don't have an outrageous number of iterations, it's more the time it takes to run a few hundred, I believe something is timing ut and causing my application to close down, hunting around the warnings led me to believe it might be something to do with erroneous infinite loop detection.
Eric Delgado
Eric Delgado 2022년 10월 6일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Outputs에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by