필터 지우기
필터 지우기

Why are alternative forms for "dbstop in file at location if expression" not documented?

조회 수: 5 (최근 30일)
This question is prompted by another question here.
It was fairly easy to guess that
dbstop('file','10')
would set a breakpoint in file.m at line 10. I can see that also it accepts a structure as generated by dbstatus.
Shouldn't it be possible, though, to use the above format with various arguments to obtain most or all of the seventeen behaviors listed in the documentation? If so, why are these forms not documented? If not, why does the above code work?
Edit: I just found the contextual function hints. The answer is
dbstop('in','file','at','line','if','expression')
But I'll accept an answer that can explain the reasoning behind the more common forms.

채택된 답변

John D'Errico
John D'Errico 2021년 11월 15일
편집: John D'Errico 2021년 11월 15일
All commands in MATLAB are actually implemented as functions. There is a command/function duality in existence. So you can always call the function as if you were issuing a command, if you provide the proper arguments to that function. This is true for any command, as far as I can think of.
But DBSTOP is surely one of those commands that were probably never expected to be used programmatically. Why would you be calling for a debug stop inside another function? Surely that would at least seem dangerous. So it looks like dbstop was written as if it would always be called in command form, even though in reality, the code lives inside the dbstop function itself. And it was documented as if that is the case.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2012b

Community Treasure Hunt

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

Start Hunting!

Translated by