以编程方式控制范围块

此示例显示如何使用编程脚本控制范围。

使用Si金宝appmulink配置对象

使用范围配置对象进行编程访问范围参数。

  • 修改标题,轴标签和轴限制

  • 打开或关闭图例或网格

  • 控制输入​​的数量

  • 更改显示的数量,显示器处于活动状态

创建模型并添加范围和时间范围块。然后,使用get_param.要创建范围配置对象我的配置

mdl ='mymodel';new_system(MDL);add_block('金宝appsimulink / sinks / scope',[MDL.'/ myscope']);add_block('DSPSNKS4 /时间范围',[MDL.'/ mytimescope']);myconfiguration = get_param([mdl'/ myscope'],'scopeconfiguration'的)
MyConfiguration =具有属性的范围配置:名称:'MyScope'位置:[360 302 560 420]可见:0 OpenatsImulationStart:0 DisplayfullPath:0 PreservecolorsForCopyToclipboard:0 NumInputports:'1'LayOutDimensions:[1] Sampletime:'-1'FrameNaSedProcessing:0 Maximizeaxes:'Off'MinimizeControls:0 Axesscaling:'手动'AxesscalingNumupdates:'10'时间:'auto'timespanoverrunation:'wrap'时髦:'无'timeyisplayOffset:'0'timeaxislabels:'0'simeaxislabels:'0'showtimeaxislabel:0 ActiveDisplay:01标题:'%'showlegend:0 showgrid:1 plotasmagnitudehase:0 ylimits:[-10 10] ylabel:''dataloggingvariablename:'scopedata datalogginglimitdatapoints:0 dataloggingmaxpoints:0 dataloggingmaxpoints:0 dataloggingmaxpoints'2'dataloggingsaveformat:'dataset'

设置属性。

myconfiguration.dataloggingmaxpoints ='10000';

找到范围和时间范围块。

find_system(MDL,'看起来很疯狂''在''包括''在'......'全锁''在''blocktype''范围'的)
ANS =.2x1细胞{'mymodel / myscope'} {'mymodel / mytimescope'}

仅查找Simulin金宝appk Scope块。

find_system(MDL,'看起来很疯狂''在''包括''在'......'全锁''在''blocktype''范围''defaultconfigurationname'......'金宝appsimulink.scopes.timescopeblockcfg'的)
ANS =.1x1细胞阵列{'mymodel / myscope'}

只发现DSP时间范围块。

find_system(MDL,'看起来很疯狂''在''包括''在'......'全锁''在''blocktype''范围''defaultconfigurationname'......'spbscopes.timescopeblockcfg'的)
ANS =.1x1细胞阵列{'mymodel / mytimescope'}

范围配置属性

有关scope配置对象属性的详细信息,请参阅timescopeconfiguration.

也可以看看

||

相关话题