Richard is a Consultant at MathWorks focused on the Embedded Coder product for code generation, primarily in the Aerospace
My pick this week is Ugly Data App – a tool to clean up data .
This submission is a great example of the types of complex User Interfaces that can be created using MATLAB’s App Designer.
The tool itself allows the user to bring in data from the MATLAB workspace and then operate on it in a number of ways.
The first option is to handle missing values. The user can specify how the missing data should be handled by selecting a
fill method from the list such as Linear or Spline. The tool also allows the user to constrain the data by specifying thresholds
at which the data will be replaced with NaNs. As an example, the data may only be valid for values greater than zero. This
allows you to eliminate those erroneous data points.
The next option is to handle any outliers in the data. The user can specify the outlier method to use from a list and the
corresponding parameters associated with the method such as the threshold factor. The plot is updated to show the boundaries
of the outliers. Similar to the Missing Data, the user can specify a fill method for the outliers from a list.
The third option allows the user to smooth the data. The smoothing method can be selected from a list and the smoothing parameters
Once the data has been “cleaned”, it can be exported to either MATLAB’s Workspace or to an Excel file via the “Export Data”
menu item. There are also menu items to specify “Plot Options”, provide “Feedback” to Adam, and to get “Help” for the App.
However, the feature of this App that sets it apart is the ability to “Generate Code”. This menu item allows the user to
automatically create a MATLAB script or function that performs the same steps. This allows the user to “set-up” the data
cleaning once, and then easily apply it to as many data sets as desired. The resulting MATLAB code follows the same steps
that the user did manually. As such, the user needs to keep this in mind when working with the data. You probably don’t
want to insert NaNs after having filled the NaNs. The order of the steps can be seen in the lower left corner in the “Code
There are some enhancements that I would like to see Adam make to this App:
- Provide “zoom” capability on the plot to allow the user to focus in on a section of the data.
- Provide more documentation on the usage of the App. A set of examples highlighting the capabilities would be beneficial.
- Provide an option to show a subplot of the difference between the original data and the adjusted data.
- Insert a marker for any NaNs found in the raw data and not just those that are byproducts of setting boundaries.
As stated before, this is a great example of the custom User Interfaces you can build in MATLAB. If you have test data that
contains dropouts or outliers, this App allows you to manually adjust the data. However, the real benefit is the ability
to then create a custom MATLAB script/function to perform the same adjustments – which allows it to be applied to many sets
of data. Give it a try and let us know what you think here or leave a message for Adam.
Published with MATLAB® R2017b
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.