You are watching: How to stop infinite loop in matlab
"exit" is a constructed in role that terminates a MATLAB program. Don"t use that name, obviously, or any other surname of any type of other integrated function.
Put the strfind inside the when test and also inside a contact to isempty(), so do those two lines into this solitary line.
Thank you a lot, I"ll start doing the now. What i did come "fix" it prior to you comment is the I put question right into the cube if statement, yet then that really only fixed the difficulty if the user starts through a question about a volume that a cube with height = x. If they ask about any other shapes, that just display screens their question until they ask about a cube and then works correctly. How deserve to I settle that?
I am utilizing if conditions in simulink with logical operators and i experince same trouble , matlab hangs after running the simulation.I doubt if the loop goes to inifinity and if therefore how deserve to i correct it in simulink .My design is a power mechanism model and also if condition has to check net power at ac network continuosly during simulation time.can i include any other block in simulink chin to deal with this isissue or need to write regimen
Use a failsafe like I showed: a examine on the number of iterations so you don"t get into an infinite loop.
Attach your password if friend need more help. Yet I don"t have actually Simulink so I can only recommend on MATLAB code.
Community endowment Hunt
Find the prizes in MATLAB main and discover how the ar can assist you!begin Hunting!
one Error occurred
Unable to finish the activity because of transforms made come the page. Reload the page to view its updated state.
select a internet Site
Choose a web site to gain translated content where easily accessible and see local events and also offers. Based on your location, us recommend that you select: .select web site
How come Get best Site Performance
Select the China site (in Chinese or English) for finest site performance. Other thedesigningfairy.com country sites are not optimized for visits from her location.
See more: The Egyptian Empire: Land Of The Pyramids Ideas, Ancient Egypt: Land Of The Pyramids
Accelerating the pace of engineering and also science
thedesigningfairy.com is the top developer that mathematical computing software because that engineers and also scientists.