skipping errors in a script
Mostrar comentarios más antiguos
Hi, I have a script which consists of several functions:
functionA
functionB
functionC
Sometimes I get this error:
Index exceeds matrix dimensions.
Error in functionB (line 44) golrowA = cellContentsA((LA):(LA+120), :);
The question is how can I skip this error so that functionC gets executed because if the error occurs whilst running function B then the entire script stops and then the remaining functionC does not run.
thanks
Respuesta aceptada
Más respuestas (1)
Although the best solution is to figure out why you are getting those error messages, and fix the problem at the source. Because just skipping over errors is a great way to lose control of what the code is actually doing. Instead, dig into your code, find out why that line gets an index over the size of its array, create a special case to break out of the loop or whatever is a reasonable way to avoid this case. Then your code will be more robust, and it will not hide any future errors from you.
Don't just paste some wallpaper over the cracks in the wall, find out what the problem is and fix it.
Categorías
Más información sobre Performance and Memory en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!