Using conditional breakpoints to print out value
Ältere Kommentare anzeigen
Hi, I'm interested if it would be possible to use/abuse(?) conditional breakpoints to print out the value of a variable to the command window. Sometimes I work with a codebase that is read-only, so I can't insert 'disp()' statements... Thanks!
Akzeptierte Antwort
Weitere Antworten (2)
per isakson
am 12 Feb. 2013
Bearbeitet: per isakson
am 12 Feb. 2013
1 Stimme
The function invoked at the conditional break point shall always return true and not error. Printing should be fine. If the name of variable isn't known beforehand one may use whos/who.
Once the code stops at breakpoint, you can highlight a variable or expression in the editor window. Then right-click and select "Evaluate Selection".
You should also be able to see the value of a variable by hovering the mouse over any occurrence of it in the editor.
1 Kommentar
Eric Sampson
am 12 Feb. 2013
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!