Generate Function for Features
Generate MATLAB® code for features you select when you want a command-line version of the computations you performed interactively in the app. The app provides code that reproduces both the preliminary data processing and the feature extraction itself. For example, if you select features that are based on power spectra that you computed in the app, the generated code includes the spectral processing as well as the feature processing.
You can choose between two code formats:
Function formatted for use with ensemble data sets. This is the default format. Use this option when you want to apply your feature extraction computations to other ensemble data sets. For example, use this option when you want to apply features developed using a small data set to a larger data set.
Function formatted for streaming. Use this option when you want to perform feature extraction on streaming data. The function accepts streaming data and is MATLAB Coder™ compliant so you can convert the function to C or C++. You cannot export computations based on spectral variables that are computed using autoregressive or state-space models. To export spectral features in a streaming function, use the Welch method to compute the spectrum variable. You also cannot export features derived from ensemble statistics variables or features derived from frame-based data.
You can select all the features in a single feature table, or select only the top-ranked features in that table.
In Feature table, select the feature table you want to work with.
In Features sorted by, choose the ranking algorithm you want to use
to order the features for selection. Only the ranking algorithms that you applied during your
session appear as options. If you want to generate code for all features regardless of
ranking, select Use All Features
.
In Number of top features, choose how many features you want to generate code for. This option is active only when you are exporting ranked features. If you do not specify a ranking method, the app generates code for all features.
In Format for streaming data, select the option if you want to use the function on streaming data rather than on an ensemble data set.
When you click OK, the app generates the code in a function in the editor.
If you want to customize your selection further, such as by filtering the features for specific inputs or methods, use Generate Function for…. Selecting this option opens a list of all the signals, features, and ranking tables you can choose from, and also opens the Code Generation tab. The Code Generation tab allows you to filter the items in the selection list to refine what the generated code includes. View all your selections together with no filters by clicking Sort by Selection. When your selections are complete, click Generate Function. Generate Function for… does not support streaming data.
For more information, see: