Greetings,
I am currently in the process of adding error messages to my code. However, an issue that I cannot seem to solve is how to make my error message point to where the error occurred, and not the line where the 'error' command is placed.
E.g. the problem occurs at line 72, where the value x0 is wrong, but the check and the error message is placed at lines 106-108, as shown below
70 - % Location of the scatterer.
71 - z0 = 380;72 - x0 = 210;...106 - if xsc(1) < 0 || xsc(end) > D107 - error('Scatterer out of bounds. Redefine cross-range position.')108 - end
Therefore, if the error message is triggered, I get the output
Error using IKMt (line 107)Scatterer out of bounds. Redefine cross-range position.
Instead, I would like the error message to link to line 72, where x0 is inserted improperly.
Currently running Matlab R2012b.
Any help would be greatly appreciated.
Best Answer