How to smooth Data on App Designer for only plot on display

3 visualizzazioni (ultimi 30 giorni)
Hello Everyone,
I'm trying to smooth some dataset on an app I'm creating on App Designer. The app imports several different datasets and I have made buttons to call up data and plot each separately in an axes I created although not simultaneosly. Now I want to add a slider underneath to smoothen any given dataset on display. Any advice on how to make a custom slider for this?
Thanks in advance.

Risposte (1)

TADA
TADA il 27 Lug 2021
You can save the original data in a different property, then plot it as response to the slider callback
See simple example I made that uses a button, slider and axes
the button randomizes some noisy data, and both button and slider callbacks call the doplot function which smoothes the original data according to the spinner value.
here moving average smoothing is applied and the smoothing span is controlled by the spinner value.
  2 Commenti
Daniel Abraham
Daniel Abraham il 27 Lug 2021
Hi, thank you for your reply, I tried this but it tells me this.
Undefined function 'smooth' for input arguments of type 'double'.
Error in app1/onclick (line 34)
app.doplot();
By the way, does this work for multiple datasets? I have about 4 different buttons that make different plots, how will the slider smooth for each of them?
TADA
TADA il 27 Lug 2021
I'm pretty sure smooth is part of the curve fitting toolbox, if you don't have access to that toolbox, you can look in the file exchange, someone surely implemented something...
Or you can pretty easily implement some simple smoothing filter yourself
As for multiple datasets, you can pretty easily implement the same thing, either by calling several methods from the callback hardcoded, or by calling a list of function handles in a loop, or save the datasets in a cellarray for instance and plotting using a loop or any number of other solutions. It's up to you

Accedi per commentare.

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by