How to filter a signal(s) open in a UIAXES in matlab app designer?

1 view (last 30 days)
Hi All
I have a listbox from which I choose some signal names and plot them on my UIAXES. now wanted to make a filter button. how could I transfer those signals to the filtering button ?
maybe assuming I have 3 signals already plotted
  2 Comments
farzad
farzad on 6 Apr 2020
well, as you remember, I click on some filenames and I also have put a hold on button that I can hold the plots when being plotted on the UIAXES. once this is done and I have 3 plots present in the UIAXES, I want to press the filter button, with some defined variables let's say this one , get the plotted signals' variables : x-t and (then filter the x to y)
and plot the filtered signal over the same UIAXES

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 7 Apr 2020
Please check the attached file. It gives a general idea of how to apply a filter on the current line plotted on a UIAxes. You can modify it according to your requirements.
  37 Comments
farzad
farzad on 11 Apr 2020
Another problem : new : Using the plot children, I tried to plot the acceleration, but this plots nothing , why ?
app.Yd = [];
app.Xt = [];
for i=1:numel(app.UIAxes.Children)
% if strcmp(app.UIAxes.Children(i).Tag, 'uf1')
i;
app.Yd = [app.Yd; app.UIAxes.Children(i).YData];
app.Xt = [app.Xt; app.UIAxes.Children(i).XData];
% end
end
tf= app.Xt.'; %satri be sotuni
yf=app.Yd.';
dyf=gradient(yf)./gradient(tf);
ddyf=gradient(dyf)./gradient(tf);
cla(app.UIAxes)
drawnow;
pa1=plot(app.UIAxes, tf(:,1), ddyf(:,1))
pa1.Tag = 'acc1'; % unfiltered
hold(app.UIAxes,'on');
farzad
farzad on 11 Apr 2020
pa1has data but nothing is drawn
pa1 =
Line with properties:
Color: [0 0.4470 0.7410]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [1×15360 double]
YData: [1×15360 double]
ZData: [1×0 double]

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!