Line number in code
Show older comments
Is there a way of identifying the number of the line of code where one outputs (e.g. fprintf) a message?
For example, suppose I want to identify where in my code a particular "break" statement is executed:
fprintf('\t\t(2000) function_X:\t**** Break out ****\n');
I might have other such statements:
fprintf('\t\t(2903) function_X:\t**** Break out ****\n');
Can I automate the line nos. "2000" & "2903" to something dynamic such as:
fprintf('\t\t(<line no>) function_F:\t**** Break out ****\n');
This would allow me to enter or delete lines of code without having to search for and bring up-to-date the line nos. in the fprintf statements.
1 Comment
Marcel Kreuzberg
on 7 Apr 2022
maybe it is possible using matlab commands: error or warning
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!