プログラムによる Scope ブロックの制御
この例では、プログラミング スクリプトを使用してスコープを制御する方法を説明します。
Simulink 構成オブジェクトの使用
プログラムによって Scope のパラメーターにアクセスするために、Scope の構成オブジェクトを使用します。
タイトル、軸ラベルおよび軸の範囲の変更
凡例またはグリッドの表示/非表示の切り替え
入力の数の制御
表示の数とアクティブな表示の変更
モデルを作成し、Scope ブロックと Time Scope ブロックを追加します。次に、get_param を使用して Scope 構成オブジェクト myConfiguration を作成します。
mdl = 'myModel'; new_system(mdl); add_block('simulink/Sinks/Scope', [mdl '/myScope']); add_block('dspsnks4/Time Scope', [mdl '/myTimeScope']); myConfiguration = get_param([mdl '/myScope'],'ScopeConfiguration')
myConfiguration =
Scope configuration with properties:
Name: 'myScope'
Position: [360 302 560 420]
Visible: 0
OpenAtSimulationStart: 0
DisplayFullPath: 0
PreserveColorsForCopyToClipboard: 0
NumInputPorts: '1'
LayoutDimensions: [1 1]
SampleTime: '-1'
FrameBasedProcessing: 0
MaximizeAxes: 'Off'
MinimizeControls: 0
AxesScaling: 'Manual'
AxesScalingNumUpdates: '10'
TimeSpan: 'Auto'
TimeSpanOverrunAction: 'Wrap'
TimeUnits: 'None'
TimeDisplayOffset: '0'
TimeAxisLabels: 'Bottom'
ShowTimeAxisLabel: 0
ActiveDisplay: 1
Title: '%<SignalLabel>'
ShowLegend: 0
ShowGrid: 1
PlotAsMagnitudePhase: 0
YLimits: [-10 10]
YLabel: ''
DataLogging: 0
DataLoggingVariableName: 'ScopeData'
DataLoggingLimitDataPoints: 0
DataLoggingMaxPoints: '5000'
DataLoggingDecimateData: 0
DataLoggingDecimation: '2'
DataLoggingSaveFormat: 'Dataset'
プロパティを設定します。
myConfiguration.DataLoggingMaxPoints ='10000';Scope ブロックおよび Time Scope ブロックを検索します。
find_system(mdl,'LookUnderMasks','on','IncludeCommented','on', ... 'AllBlocks','on','BlockType','Scope')
ans = 2×1 cell
{'myModel/myScope' }
{'myModel/myTimeScope'}
Simulink Scope ブロックのみを検索します。
find_system(mdl,'LookUnderMasks','on','IncludeCommented','on',... 'AllBlocks','on','BlockType','Scope','DefaultConfigurationName',... 'Simulink.scopes.TimeScopeBlockCfg')
ans = 1×1 cell array
{'myModel/myScope'}
DSP Time Scope ブロックのみを検索します。
find_system(mdl,'LookUnderMasks','on','IncludeCommented','on',... 'AllBlocks','on','BlockType','Scope','DefaultConfigurationName',... 'spbscopes.TimeScopeBlockCfg')
ans = 1×1 cell array
{'myModel/myTimeScope'}
Scope のコンフィギュレーション プロパティ
Scope 構成オブジェクトのプロパティの詳細については、TimeScopeConfigurationを参照してください。
参考
Floating Scope | Scope | Scope Viewer