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

5 vues (au cours des 30 derniers jours)
Daniel Abraham
Daniel Abraham le 27 Juil 2021
Commenté : TADA le 27 Juil 2021
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.

Réponses (1)

TADA le 27 Juil 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 commentaires
Daniel Abraham
Daniel Abraham le 27 Juil 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)
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 le 27 Juil 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

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by