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

조회 수: 14 (최근 30일)
Daniel Abraham
Daniel Abraham 2021년 7월 27일
댓글: TADA 2021년 7월 27일
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.

답변 (1개)

TADA
TADA 2021년 7월 27일
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
Daniel Abraham
Daniel Abraham 2021년 7월 27일
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 2021년 7월 27일
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

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by