MATLAB: Plotting filtered time-series data on UIAxes in App Designer

app designertimeseriesuiaxeswelch powerspectra

I'm having trouble plotting some time-series data in App Designer (using 2017b) on a UIAxes. The original data is very noisy, hence the loaded data (which the user selects by UIGetFile) gets detrended and notch filtered (the frequencies for the Notch are from a UITable, which the user enters) after checking the Welch PowerSpectra on a separate UIAxes. I can easily get it to work outside of App Designer but it would be excellent to keep it all in the UIFigure and on the specified UIAxes (I can get the filtered timeseries data to display in a seperate plot, just not in the UIAxes [had the same trouble with the Spectrogram]).
% main lines of code
Bx = app.Bx; % Grabs data from loaded file
t = 0:(size(Bx,1)-1); % Sets the time from size of data
t = t/Freq; % divides time by Frequency @ which the data is recorded
FreqNotch = app.UITable.Data; % Grab Frequencies to Notch from values entered in UITable
Bx = detrend(Bx,'constant'); % Get rid of the mean
Bx1 = timeseries(Bx, t); % Set the timeseries
ts1 = idealfilter(Bx1,FreqNotch,'Notch'); % Notch filter the data
plot(app.UIAxes, ts1); % Doesn't work
plot(ts1); % Does Work
The Error message is:
Error using plot. Data Must be numeric, datetime, duration or an array convertible to double.
Thanks.
EDIT
Added Bx.mat which is 1 Channel of noisy time-series (~14 min) data @ 1000 Hz
Noise is at 50 Hz from powerlines and it's harmonics at 150, 250, 350, 450
Can change the line of code to following for the Frequencies to Notch at
FreqNotch = [49,50; 149,151; 249,251; 349,351; 448,452];

Best Answer

Your data is uploaded in Timeseries format. You need to reach to its field by dot notation. Run the attached app and see if it works for you. Also, go to the buttonPushedCallback and see what I did.