Main Content

Create or Import Signal Label Definitions

In Signal Labeler, you can import already existing signalLabelDefinition objects stored in MAT files, or you can add signal label definitions to your labeledSignalSet directly in the app.

Use signal label definitions to define labels for signals. Labels can be of six types:

  • Attribute labels define characteristics of the signal as a whole.

  • Region-of-interest (ROI) labels define signal characteristics over regions of interest that have start and end times.

  • Point labels define signal characteristics at one point of interest in time.

  • Time-Frequency ROI labels define spectrogram characteristics over regions of interest that have start and end points for both time and frequency.

  • Feature Attribute labels define characteristics of the signal as a whole that correspond to features.

  • Feature ROI labels define signal characteristics over regions of interest that correspond to features.

Note

Signal Feature Extractor generates attribute feature labels and ROI feature labels automatically when you extract features. For more information, see Feature Extraction Using Signal Feature Extractor.

Each label can have one of four data types:

  • Logical labels can be either true or false.

  • Categorical labels can belong to any one of a set of categories that you specify.

  • Numeric labels can have any numeric value.

  • String labels can have any value represented by a string.

Example: Create a definition to label a signal with its mean RMS value as a numeric attribute.

  • At the command line, the code

    lblRMS = signalLabelDefinition("MeanRMSattr", ...
    'LabelType','attribute','LabelDataType','numeric');
    save('MeanRMSdef','lblRMS')
    creates a file, MeanRMSdef.mat, that you can load into Signal Labeler to import a label definition called MeanRMSattr.

  • In Signal Labeler, click Add Definition on the Labeler tab and select Add label definition. In the dialog box, specify Label Name as MeanRMS, Label Type as Attribute, and Data Type as numeric.

Example: Create a definition to label the zero crossings of a signal as "rising" for positive-going transitions and "falling" for negative-going transitions.

  • At the command line, the code

    ldf = signalLabelDefinition("Crosses",'LabelType','point', ...
    'LabelDataType','categorical','Categories',["rising","falling"]);
    save('CrossDef','ldf')
    creates a file, CrossDef.mat, that you can load into Signal Labeler to import a label definition called Crosses.

  • In Signal Labeler, click Add Definition on the Labeler tab and select Add label definition. In the dialog box, specify Label Name as crossings, Label Type as Point, Data Type as categorical, and categories as rising and falling, with each category on a new line.

Import Signal Label Definitions

To import existing signal label definitions, click Import on the Labeler tab and select Label Definitions From file. In the dialog box, specify the name of the MAT file that contains the label definitions you want to import. The MAT file must contain only one vector of signalLabelDefinition objects.

Create Label Definitions

To add a signal label definition to your labeled signal set, click Add Definition on the Labeler tab and select Add label definition. In the dialog box, specify the following fields:

  • Label Name — Specify the name in the text box.

  • Label Type — Select one of Attribute, ROI, Point, or Time-Frequency ROI.

  • Label Description (optional) — Specify the description in the text box.

  • Data Type — Select one of string, numeric, logical (the default), or categorical.

  • Categories — This field appears if you specify Data Type as categorical. Enter each category on a new line.

  • Default (optional) — Specify a default value for the signal label. For logical labels, select either true or false. For categorical labels, select any of the categories you specified.

  • Time-Frequency Transform: Spectrogram — This section appears if you specify Label Type as Time-Frequency ROI. Use this section to specify options for the spectrogram used for time-frequency labeling.

Add label definition dialog box

This action is equivalent to using addLabelDefinitions at the command line.

Note

If you want to reuse the signal label definitions that you created during a Signal Labeler session, you must export the definitions to a MAT file and import them in a subsequent session.

Specify Spectrogram Options for Time-Frequency ROI Label Definitions

When you create a time-frequency ROI label definition, you must specify options for Signal Labeler to compute the spectrogram from which to label. Signal Labeler uses default options. To change spectrogram options, select the Time-Frequency ROI dropdown item under Label Type, then click Options under Time-frequency Transform.

There are three ways in which you can divide a signal into segments for spectrogram computation: by controlling leakage, by controlling resolution bandwidth, or by controlling window length. For more information, see Spectrogram Computation in Signal Labeler. This table lists the parameters that you can specify depending on the method you choose.

OptionsSpecifications
Resolution Type

Resolution Type — Spectrogram resolution type, returned as one of these:

  • Leakage — Specify leakage parameters to compute the spectrogram.

  • RBW (π rad/sample) — Specify resolution bandwidth (RBW) parameters to compute the spectrogram.

  • Window Length — Specify window length parameters to compute the spectrogram.

Leakage Parameters

Leakage — Spectral leakage, specified as a nonnegative scalar less than or equal to 40.

Time Resolution — Mode to set the time resolution in the spectrogram computation, specified as one of these:

  • AutoSignal Labeler automatically sets the time resolution of the spectrogram.

  • Specify — You can specify the time resolution of the spectrogram.

Resolution — Time resolution of the spectrogram, in samples, specified as a positive scalar.

Overlap (%) — Percentage of overlapped samples between adjoining segments, specified as a nonnegative scalar less than 100.

Reassign — Option to reassign spectrogram values. If you enable this option, Signal Labeler sets the spectrogram computation to sharpen the localization of spectral estimates by performing time and frequency reassignment. The reassignment technique produces periodograms and spectrograms that are easier to read and interpret. This technique reassigns each spectral estimate to the center of energy of its bin instead of the bin's geometric center. The technique provides exact localization for chirps and impulses.

RBW Parameters

RBW — Mode to set the resolution bandwidth in the spectrogram computation, specified as one of these:

  • AutoSignal Labeler automatically sets the resolution bandwidth of the spectrogram.

  • Specify — Specify the resolution bandwidth of the spectrogram as a positive scalar.

Window — Window, specified as Blackman-Harris, Chebyshev, Flat-top, Hamming, Hann, Kaiser, or Rectangular. For more information, see Windows.

Sidelobe Attenuation (dB) — Sidelobe attenuation of Chebyshev or Kaiser window, specified in decibels as a scalar greater than or equal to 20 (Chebyshev window) or 45 (Kaiser window).

Overlap (%) — Percentage of overlapped samples between adjoining segments, specified as a nonnegative scalar less than 100.

Window Length Parameters

Window Length — Mode to set the window length in the spectrogram computation, specified as one of these:

  • AutoSignal Labeler automatically sets the window length of the spectrogram.

  • Specify — Specify the window length of the spectrogram as a positive integer.

Window — Window, specified as Blackman-Harris, Chebyshev, Flat-top, Hamming, Hann, Kaiser, or Rectangular. For more information, see Windows.

Sidelobe Attenuation (dB) — Sidelobe attenuation of Chebyshev or Kaiser window, specified in decibels as a scalar greater than or equal to 20 (Chebyshev window) or 45 (Kaiser window).

Overlap (%) — Percentage of overlapped samples between adjoining segments, specified as a nonnegative scalar less than 100.

NFFT — Mode to set the number of discrete Fourier transform (DFT) points in the spectrogram computation, specified as one of these:

  • AutoSignal Labeler automatically sets the number of DFT points used to calculate the spectrogram.

  • Specify — Specify the number of DFT points used to calculate the spectrogram as a positive integer.

Power Parameters

Minimum Power Limit (dB) — Mode to set the minimum power threshold of the spectrogram, specified as one of these:

  • AutoSignal Labeler automatically sets the minimum power threshold of the spectrogram.

  • Specify — Specify the minimum power threshold of the spectrogram as a real-valued scalar expressed in decibels. This value represents the lower bound for nonzero values in the spectrogram computation.

Spectrum in dB — Option to use decibels in the spectrogram's magnitude. If disabled, Signal Labeler sets the option to use one of these time-frequency representations:

  • Short-term, time-localized power spectrum estimate, if you specify leakage parameters.

  • Modified periodogram estimate of the PSD or power spectrum, if you specify RBW or window length parameters.

Once you create a time-frequency ROI label definition with spectrogram options, Signal Labeler locks the specified spectrogram options for time-frequency labeling. You will not be able to draw labels while spectrogram options are unlocked.

To unlock the spectrogram options for further modification before labeling, edit the label definition or unlock the spectrogram display settings.

  • To modify the spectrogram options by editing the label definition, select the time-frequency ROI label definition, click the Edit button in the Label Definition section under the Labeler tab or right-click the label definition and select Edit, click on the lock icon under Time-frequency Transform, and click Options.

  • To modify the spectrogram options by unlocking the spectrogram display settings, toggle the Spectrogram button in the Display tab, and click the lock icon under the Spectrogram tab.

Create Sublabel Definitions

To add a sublabel definition, select the definition in the Label Definitions browser, click Add Definition on the Labeler tab, and select Add sublabel definition. The top of the dialog box shows, as Parent Name, the name of the label to which you are adding the sublabel.

This action is equivalent to using addLabelDefinitions at the command line.

Note

A label can have any number of sublabels. Sublabels themselves cannot have sublabels. Time-frequency ROI label definitions do not support sublabels.

Edit Label or Sublabel Definitions

To edit a label or sublabel definition, select the definition in the Label Definitions browser and click the Edit button. In the dialog box, specify the following fields:

  • Label Name — Specify the value in the text box.

  • Label Description — Specify the value in the text box.

  • Categories — This field appears if you specify Data Type as categorical. You can add categories, but you cannot remove any existing categories. Enter each new category on a new line.

  • Default — Specify a default value for the signal label. For logical labels, select either true or false. For categorical labels, select any of the categories you specified.

    Editing the default value does not affect existing labels. The new default value applies only to new members, new regions, or new points.

  • Time-Frequency Transform: Spectrogram — This section appears if you specify Label Type as Time-Frequency ROI. Use this section to specify options for the spectrogram used for time-frequency labeling. If you already specified spectrogram options, the options can show as locked. You can unlock and edit the options, but note that editing the options can make existing time-frequency labels incompatible.

You cannot modify the Label Type or Data Type fields. To change the label type or the data type of a label definition, remove the definition and add a definition with the desired properties.

This action is equivalent to using editLabelDefinition at the command line.

Delete Label or Sublabel Definitions

To delete a label or sublabel definition, select the definition in the Label Definitions browser and click the Delete button on the toolstrip.

This action is equivalent to using removeLabelDefinition at the command line.

See Also

Apps

Objects

Topics