MATLAB: How to stop the program? “Break” – Error

breakerrorMATLAB

I am using a "Break" to stop the program but it is showing an error. How can I solve that and stop the program? Thanks

Best Answer

break is used to break a for or while loop. Use return instead to end the function. Use error(some error message) to completely end the program due to an error.