Borrar filtros
Borrar filtros

Debug and workspace of functions

8 visualizaciones (últimos 30 días)
M B
M B el 18 de Mzo. de 2014
Respondida: Jacob Halbrooks el 18 de Mzo. de 2014
Hello Everybody,
When I run a MATLAB code which includes several function files, the variables I see in workspace are only of the main file (the file that runs the code). I also want to see in workspace local variables of other fuctions. How can I add them to workspace?

Respuestas (1)

Jacob Halbrooks
Jacob Halbrooks el 18 de Mzo. de 2014
Each function has its own separate workspace of variables, and you do not typically get visibility of the variables outside of your current workspace. However, you can navigate your function call stack to inspect the workspace of each function. For example, put a breakpoint in your code and invoke your function to reach the breakpoint. In the MATLAB Editor, there should be a dropdown control to select where to go in the call stack (or you can do this at the command line using DBUP and DBDOWN). Then use the Workspace browser or WHOS to inspect the variables.

Categorías

Más información sobre Debugging and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by