how to check the contents of the variables?
5 次查看(过去 30 天)
显示 更早的评论
Hai,
While the program is running, how can I check the contents of the variables declared in the program? Looking for your reply.
BSD
0 个评论
采纳的回答
Naz
2011-10-27
don't put the semi column after the statement
x=5
and you will get the expression in Command Window:
>>x=
>> 5
2 个评论
Jan
2011-10-27
Does "see values in the workspace" mean in the workspace browser? Does this make sense, when the program is running and the value is changing frequently? Setting a debugger breakpoint seems to be a good idea.
更多回答(2 个)
Andreas Goser
2011-10-27
When the program is paused, you may be able to see the content in the Workspace Browser.
BUT
It again depends on your application. You are asking multiple simple sounding questions, but they need a context to give you a good solution.
Maybe, it is the most efficient and effective way for everybody to make a call together with your supervisor and Technical Support?
0 个评论
Walter Roberson
2011-11-1
If your program is actively running and not paused for keyboard input (or the debugger), there is no way to examine variables in any of the workspaces. The command window will not execute commands while the program is running, and there is no mechanism in MATLAB to pause execution "where-ever the program happens to be now".
The closest you can get to this is to create a graphic button whose callback sets a variable that your code examines, with the code calling keyboard() or setting a breakpoint to give the user a chance to poke around.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!