Import Data into Signal Labeler

The Signal Labeler app works with real-valued vectors, matrices, MATLAB® timetables, and labeledSignalSet objects in the MATLAB Workspace.

Note

Signal Labeler does not support complex-valued signals, signals with Inf or NaN values, multidimensional arrays, or sparse matrices.

Specify Time Information

The signals you import into Signal Labeler can be labeled in samples or in time. This specification stays fixed to ensure consistent labeling. You cannot mix signals in samples and signals with time information in the same session.

  • Example: Numeric Arrays

    num = cos(pi./[4;2]*(0:159))'+randn(160,2);
    specifies a two-channel signal consisting of sinusoids embedded in white noise. The signal does not contain time information unless you specify it. In Signal Labeler, you can import the signal in samples, or you can add time information when you import it.

  • Example: MATLAB Timetables

    tt1 = timetable(num,'SampleRate',100);
    tt2 = timetable(seconds((0:159)'/100),num);
    both specify that the noisy two-channel sinusoid is sampled at 100 Hz. For more information, see the timetable documentation.

  • Example: labeledSignalSet Objects

    lss = labeledSignalSet(num);
    specifies that the noisy sinusoid is in samples.

  • Example: labeledSignalSet Objects with Time Information

    lst1 = labeledSignalSet(num,'SampleRate',100);
    lst2 = labeledSignalSet(timetable(seconds((0:159)'/100),num));
    both specify that the noisy sinusoid is sampled at 100 Hz.

Import Signals from the MATLAB Workspace

To import signals to Signal Labeler from the MATLAB workspace, on the Labeler tab, click Import ▼ and select Members From Workspace. In the dialog box, select the signals you want to import.

Import Members from Workspace dialog box

When specifying the time information for a set of signals that do not have it, select a time specification option in the Import Members From Workspace dialog box.

Time Specification OptionDescription
SamplesThis option enables you to explore and label signals without the need to specify a sample rate or a sample time. It is equivalent to plotting the signal in MATLAB without x-axis information.
Sample RateUse this option when you know the rate at which the signal has been sampled. The sample rate can be expressed in Hz, kHz, MHz, or GHz. To specify the sample rate, you can use a numeric value, the name of a scalar variable in the MATLAB Workspace, or any valid MATLAB expression. Set the sample rate so that the members are plotted in units of time.
Sample TimeUse this option when you know the time interval between samples. The sample time can be expressed in seconds, years, days, hours, minutes, milliseconds, microseconds, or nanoseconds. To specify the sample time, you can use a numeric value, the name of a scalar variable in the MATLAB Workspace, or any valid MATLAB expression. Set the sample time so that the members are plotted in units of time.
Time Values

Use this option when you know the time value corresponding to each sample. Specify the time values using a valid MATLAB expression or the name of a variable in the MATLAB workspace. The time values can be stored in a numeric or duration vector with real time values expressed in seconds. The values must be unique and cannot be NaN, but need not be uniformly spaced. The time array must have the same length as the members.

In all cases, the app derives a sample rate from the time values and displays it in the Time column of the Labeled Signal Set browser. An asterisk preceding the sample rate indicates that the members are nonuniformly sampled.

Once a signal or set of signals has been imported into Signal Labeler, the chosen time specification stays fixed throughout the labeling session.

  • If you initially imported a numeric array and specified it in samples, or if you initially imported a labeledSignalSet object in samples, you can subsequently choose only signals in samples. If you choose a numeric array, Signal Labeler imports it and treats it in samples.

  • If you initially imported a numeric array and specified its time information, or if you initially imported a MATLAB timetable or a labeledSignalSet object with time information, you can subsequently choose only signals with time information. If you choose a numeric array, you must set its time information when importing it.

Note

You cannot modify the time information of a labeledSignalSet object from within Signal Labeler. If the labeled signal set has no time information, the app treats its members as being in samples. If the labeled signal set has time information, the app incorporates this information when it imports the signals. For more information, see the labeledSignalSet documentation.

To be imported successfully, labeled signal sets must obey these additional rules:

  • If the selection includes two or more labeled signal sets, the labeled signal sets must have unique signal label definitions. If two or more sets share a label definition, the definition must have the same type and data type for all sets.

  • If the selection includes two or more labeled signal sets, the labeled signal sets must have unique member names. You cannot change member names from within Signal Labeler. To change the name of a member of a labeled signal set, use setMemberNames at the command line.

  • If you select two or more labeledSignalSet objects for labeling, Signal Labeler merges them and creates a single labeled signal set containing all the members and label values of the input sets. This action is equivalent to using merge at the command line.

See Also

Apps

Functions

Related Examples

More About