Main Content

fixed.DataSpecification

生成するデータのプロパティの指定

R2019b 以降

説明

fixed.DataSpecification オブジェクトと fixed.DataGenerator オブジェクトを使用して、設計の動作範囲全体をテストするシミュレーション入力を生成します。

作成

説明

dataspec = fixed.DataSpecification(numerictype) は、既定のプロパティ値と numerictype で指定されたデータ型で DataSpecification オブジェクトを作成します。

dataspec = fixed.DataSpecification(numerictype,Name,Value) は、numerictype で指定されたデータ型と、Name,Value のペアの引数として指定された追加のプロパティで、DataSpecification オブジェクトを作成します。

入力引数

すべて展開する

生成されるデータのデータ型。数値データ型として評価される string または文字ベクトルか、Simulink.NumericType オブジェクトまたは numerictype オブジェクトとして指定します。

例: dataspec = fixed.DataSpecification('double')

例: dataspec = fixed.DataSpecification('fixdt(1,16,4)')

例: dataspec = fixed.DataSpecification(Simulink.NumericType);

プロパティ

すべて展開する

生成されるデータのデータ型。数値データ型として評価される string または文字ベクトルか、Simulink.NumericType オブジェクトまたは numerictype オブジェクトとして指定します。

このプロパティは作成後に編集できません。

数値データを生成する数値区間。fixed.Interval オブジェクト、fixed.Interval オブジェクトの配列、または fixed.Interval コンストラクターへの入力が含まれる cell 配列として指定します。

区間を指定しない場合、既定の区間は、指定された数値型の表現可能な最小値と最大値に等しい端点を使用します。

例: dataspec.Intervals = {-1,1};

例: dataspec.Intervals = fixed.Interval(-1,1);

生成されたデータから非正規数を除外するかどうか。logical として指定します。

このプロパティは DataTypeStr プロパティが浮動小数点型の場合にのみ適用されます。

データ型: logical

生成されたデータから負のゼロを除外するかどうか。logical として指定します。

このプロパティは DataTypeStr プロパティが浮動小数点型の場合にのみ適用されます。

データ型: logical

生成されたデータに含める値。スカラー、ベクトル、行列または多次元配列として指定します。MandatoryValues で指定した値が DataTypeStr で指定したデータ型の範囲外である場合、値は最も近い表現可能な値に飽和されます。

例: dataspec.MandatoryValues = [-215, 216];

データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi

生成されたデータの実数/複素数。'real' または 'complex' として指定します。

例: dataspec.Complexity = 'complex';

データ型: char | string

生成されたデータの次元。正のスカラー整数または正の整数の行ベクトルとして指定します。

例: dataspec.Dimensions = 3;

データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

オブジェクト関数

contains指定した値が DataSpecification オブジェクトの値の領域に含まれているかどうかの判別
applyOnRootInport(削除予定) Inport ブロックへのプロパティの適用

すべて折りたたむ

fixed.DataSpecification オブジェクトを既定のプロパティ値と int16 データ型で作成します。

dataspec = fixed.DataSpecification('int16')
dataspec = 
  fixed.DataSpecification with properties:

          DataTypeStr: 'int16'
            Intervals: [-32768,32767]
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

DataSpecification オブジェクトの既定の区間は、コンストラクターで指定されたデータ型の範囲と同等です。

-π から π の範囲を指定する fixed.Interval オブジェクトを作成します。

interval = fixed.Interval(-pi,pi)
interval = 
    [-3.1416,3.1416]

  1x1 fixed.Interval with properties:

              LeftEnd: -3.1416
             RightEnd: 3.1416
         IsLeftClosed: true
        IsRightClosed: true

この区間と fixdt(1,16,10) のデータ型を使用して DataSpecification オブジェクトを作成します。

dataspec = fixed.DataSpecification('fixdt(1,16,10)',...
    'Intervals',interval)
dataspec = 
  fixed.DataSpecification with properties:

          DataTypeStr: 'sfix16_En10'
            Intervals: [-3.1416,3.1416]
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

または、fixed.Interval コンストラクターへの入力の cell 配列として区間を指定できます。次のコードは等価の DataSpecification オブジェクトを生成します。

dataspec = fixed.DataSpecification('fixdt(1,16,10)',...
    'Intervals',{-pi,pi})
dataspec = 
  fixed.DataSpecification with properties:

          DataTypeStr: 'sfix16_En10'
            Intervals: [-3.1416,3.1416]
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

NaN 値と Inf 値を Interval オブジェクトの区間として指定することで、生成されたデータにこれらの値を含めることができます。

次のコードは、値 -Inf、Inf、NaN と範囲 [-1, 1] が含まれる Interval オブジェクトの配列を参照する DataSpecification オブジェクトを作成します。

dataspec = fixed.DataSpecification('single', 'Intervals',...
 {{-Inf}, {Inf}, {NaN}, {-1,1}})
dataspec = 

  fixed.DataSpecification with properties:

          DataTypeStr: 'single'
            Intervals: [-Inf] [-1,1] [Inf] [NaN]
     ExcludeDenormals: false
  ExcludeNegativeZero: false
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

バージョン履歴

R2019b で導入

参考

オブジェクト