Tracking the value of a variable in Debug Mode

45 Ansichten (letzte 30 Tage)
DeeWBee
DeeWBee am 7 Jul. 2015
Kommentiert: Image Analyst am 7 Jul. 2015
I have several variables that I want to track the values of throughout my function. I only seem to be able to track the value when I place a break-point at a point of interest. Is there some sort of "tag" function in which I can tell Matlab to continually track the value of a variable?
  3 Kommentare
DeeWBee
DeeWBee am 7 Jul. 2015
If I variable "X", I want the value of X to be displayed somewhere at any given moment.
Image Analyst
Image Analyst am 7 Jul. 2015
If the value is a pixel value (a gray level or RGB value), then you can use impixelinfo() where it will update a status label with the image's color as you mouse around the image. Otherwise for a general variable, then do as my answer below mentioned.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 7 Jul. 2015
You can list the variable's name by itself on it's own line in your source code, with no semicolon after it. When execution hits that line of code, it will spew the value of the variable out to the command window. No breakpoint needed.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by