目录

语法

说明

示例

显示模型的已排序列表


        slist函数的功能是在模拟调试会话期间显示已排序的模块列表。

语法

slist

说明

        slist在MATLAB®命令窗口中显示根系统以及根系统中的每个非虚拟子系统或引用模型的块的已排序列表。对于根系统、每个非虚拟子系统和每个引用模型,返回的信息包括:

  • 一个标题行,指示系统的名称、系统中非虚拟块的数量以及系统中具有直通端口的块的数量
  • 系统中每个块的条目按照排序列表中的顺序排列

每个块条目包括:

  • 以(t)s:b形式的块标识符,其中t是任务索引,s是系统索引,b是块索引。
  • 块上输入端口的数量和索引。
  • 块上输出端口的数量和索引。

        slist函数仅显示模型中的非虚拟块。虚拟块不会出现在已排序列表中。

        当一个块是代数回路的一部分时,排序列表信息还包括该块的代数回路标识符。代数回路标识符的形式为algID=s#n,其中s是包含代数回路的子系统的索引,n是系统中代数回路的索引。在模拟调试会话期间,可以使用ashow函数突出显示代数回路中的块。

        软件使用已排序列表为根系统、每个非虚拟子系统和每个引用模型创建块方法执行列表。通常,块方法按照它们在已排序列表中出现的顺序调用。在某些情况下,执行顺序可能与已排序列表中的顺序不同。例如,在将以相同速率执行的块分组到单独任务的模型中,块的执行顺序可能与已排序列表中的块顺序不同。

可以在以下情况下使用此函数启动模拟调试会话:

  • 通过Simulink®工具栏进行交互式操作
  • 通过使用sldebug函数进行编程
  • 通过使用带有'debug'名称-值参数的sim函数进行编程

示例

显示模型的已排序列表

        使用slist函数在模拟调试会话中显示模型vdp的已排序列表。

打开模型vdp。

openExample("simulink_general/VanDerPolOscillatorExample",...
    supportingFile="vdp")

        使用sldebug函数为模型vdp启动模拟调试会话。MATLAB命令提示符(>>)变为Simulink调试器提示符(sldebug @0: >>)。

sldebug vdp


(sldebug @0): >> 

使用slist函数查看模型的已排序列表。

slist
---- Sorted list for 'vdp' [13 nonvirtual block(s), directFeed=0]
     Total number of tasks = 2
- Sorted list of task index [0], 12 nonvirtual block(s)
  (0)0:1   'vdp/x1' (Integrator)
          Input ports:  [0]
          Output ports: [0]
  (0)0:2   'vdp/Out1' (Outport)
          Input ports:  [0]
          Output ports: []
  (0)0:3   'vdp/x2' (Integrator)
          Input ports:  [0]
          Output ports: [0]
  (0)0:4   'vdp/Out2' (Outport)
          Input ports:  [0]
          Output ports: []
  (0)0:5   'vdp/Scope' (Scope)
          Input ports:  [0 1]
          Output ports: []
  (0)0:6   'vdp/TAQOutportLogging_InsertedFor_x1_at_outport_0' (ToAsyncQueueBlock)
          Input ports:  [0]
          Output ports: []
  (0)0:7   'vdp/TAQOutportLogging_InsertedFor_x2_at_outport_0' (ToAsyncQueueBlock)
          Input ports:  [0]
          Output ports: []
  (0)0:8   'vdp/Square' (Math)
          Input ports:  [0]
          Output ports: [0]
  (0)0:9   'vdp/Sum1' (Sum)
          Input ports:  [0 1]
          Output ports: [0]
  (0)0:10  'vdp/Product' (Product)
          Input ports:  [0 1]
          Output ports: [0]
  (0)0:11  'vdp/Mu/Slider Gain' (Gain)
          Input ports:  [0]
          Output ports: [0]
  (0)0:12  'vdp/Sum' (Sum)
          Input ports:  [0 1]
          Output ports: [0]

- Sorted list of task index [1], 1 nonvirtual block(s)
  (1)0:1   'vdp/Constant' (Constant)
          Input ports:  []
          Output ports: [0]

 ----- Task Index Legend -----
 Task Index [0]: Cont	FiM	
 Task Index [1]: Constant	
 -----------------------------

        当完成调试时,请使用stop函数结束模拟调试会话。

stop

提示
        要交互式地启动模拟调试会话,请向模型添加一个或多个断点,并在断点列表中检查是否选择了“Pause within time step”。当模拟在断点上暂停时,MATLAB命令窗口中将可以使用一些编程调试命令,比如stop命令。

01-10 09:37