Main Content

Add Custom Analysis Functions

To create a new custom analysis using a custom MATLAB®, select one or more waveforms in the Data panel, then click the Add Analysis button. The waveforms you selected are the inputs to your custom analysis.

For example, create a custom analysis function that takes two signals, multiplies them by some constants, and then adds them.

Select your two input signals from the Data panel, then click the Add Analysis button. This launches the Mixed-Signal Analyzer — Add Analysis dialog box.

Select the Create MATLAB Function option. Define the function name and parameter prompts:

How to create custom analysis by using MATLAB function.

The app launches a new pre-populated MATLAB script. Do not modify the first section of the script. Add your custom code in custom code area highlighted by the comment:

% Begin Custom Code.
Yout = y1*str2double(dialogAnswers.Prompt1)+y2*str2double(dialogAnswers.Prompt2)

The script now looks like:

Custom analysis script.

Save and close the script. The function addSignals is now added to your custom analysis gallery. You can use the function to add any two signals. The results is listed under the Analysis Waveforms in the Data panel.

Using the custom analysis function.

See Also