Signal Labeler Import and Export Behavior

Selecting Signals to Label

You can select any combination of vectors, matrices, timetables, and labeledSignalSet objects to label using Signal Labeler, as long as the selected signals obey these rules:

  • All signals must be real valued.

  • All signals must either be in samples or have time information.

  • If the selection includes two or more labeled signal sets, the labeled signal sets must have the same signal label definitions.

  • 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 concatenates them and creates a single labeled signal set in Signal Analyzer containing all the members and label values of the input sets. This action is equivalent to using concatenate at the command line.

Note

Importing signals into Signal Analyzer is not supported when Signal Labeler is running.

Importing and Exporting Signal Label Definitions

  • To import existing signal label definitions, click Import on the Label tab. In the dialog box that appears, specify the name of the MAT-file containing the label definitions you want to import.

  • To export signal label definitions to a MAT-file, click Export on the Label tab. In the dialog box that appears, specify the name of the MAT-file containing the label definitions you want to export.

Saving Labels

At the end of a labeling session, click Save Labels on the Label tab. Signal Labeler saves the labels as labeledSignalSet objects and puts them in the Signal Analyzer Signal table. To save the labels, Signal Labeler uses these rules:

  • All signals that contain time information are converted to MATLAB® timetables.

  • If you use Signal Labeler to label a labeledSignalSet and a signal, the signal is added to the labeled signal set as a new member. If the labeled signal set stores its signals in cell arrays, the signal is added as another cell.

  • If the channels of a multichannel signal cannot be concatenated, Signal Labeler converts the signal to a cell array of timetables. If the signal has no time information, it is converted to a cell array of vectors. A multichannel signal can become non-concatenable if you preprocess one or more channels and the preprocessing changes the channel lengths or time information.

    Example: Create a three-channel random signal sampled for 1 second at 100 Hz. Import the signal into Signal Analyzer.

    signalAnalyzer(randn(100,3),'SampleRate',100)
    Expand the sig1 hierarchy. Select the second channel. On the Analyzer tab, expand the Preprocessing gallery and click the Resample icon. Select a Sample Factor of 0.5. Click Resample. Allow the app to overwrite the channel. The sample rate changes to 50 Hz.

    Select the whole signal. Start Signal Labeler by clicking Label on the Analyzer tab. Click Save Labels to exit Signal Labeler and go back to Signal Analyzer. Use the default name for the exported labeledSignalSet object. The labeled signal set contains three members that have been converted to timetables.

Exporting Labels

To save labeled signals after using Signal Labeler, you must save the Signal Analyzer session or export the labeled signals from Signal Analyzer to the MATLAB workspace or to a MAT-file. Labeled signals are exported as labeledSignalSet objects.

Example: Select the labeled signal set of the example in the previous section. On the Analyzer tab, click Export to export the labeled signal set to the MATLAB workspace. Extract the signal from the labeled signal set. The signal is a 3-by-1 cell array of timetables.

sgn = getSignal(ls,1);
sgn(:)
ans =

  3×1 cell array

    {100×1 timetable}
    { 50×1 timetable}
    {100×1 timetable}

See Also

Apps

Functions

Related Examples

More About