回 帖 发 新 帖 刷新版面

主题:如何在采集数据的窗口中设置停止按钮?

我用MATLAB编了一个采集数据的程序,采集到的数据以图形方式实时显示。我想在图形窗口上加一个按钮,按下按钮后就可以暂停采集数据,不知该如何实现。
多谢高手指点。

回复列表 (共2个回复)

沙发

用DBSTOP




DBSTOP Set breakpoint.
    The DBSTOP command is used to temporarily stop the execution of an
    M-file function and give the user an opportunity to examine the local
    workspace.  Issuing a DBSTOP command is equivalent to editing the
    M-file function and inserting a KEYBOARD command in front of the line
    number specified.  There are five forms to this command.  They are:
 
    DBSTOP IN MFILE AT LINENO
    DBSTOP IN MFILE AT SUBFUN
    DBSTOP IN MFILE
    DBSTOP IF ERROR
    DBSTOP IF WARNING
    DBSTOP IF NANINF  or  DBSTOP IF INFNAN
 
    where LINENO is a line number within M-file function MFILE.  MFILE
    must be the name of an m-file function or a MATLABPATH relative
    partial pathname (see PARTIALPATH).  The AT, IN and IF keywords
    are optional.
 
    The first form stops at the specified line number in the function.
    The second form stops at the specified subfunction in the
       multi-function m-file.
    The third form stops at the first executable line in the function.
    The fourth form causes a stop in any M-file function causing a
       run-time error. You cannot resume M-file execution after a
       run-time error.
    The fifth form causes a stop in any M-file function causing a
       run-time warning. 
    The sixth form causes a stop in any M-file function where an
       infinite value (Inf) or Not-a-Number (NaN) is detected.
 
    When a breakpoint is hit, MATLAB goes into debug mode.  On the PC
    and Macintosh the debugger window becomes active and on UNIX and VMS
    the prompt changes to a K>.  Any MATLAB command is allowed at the
    prompt.  To resume M-file function execution, use DBCONT or DBSTEP.
    To exit from the debugger use DBQUIT.

板凳

谢谢,我试试吧。

我来回复

您尚未登录,请登录后再回复。点此登录或注册