0

我在 UIAxes 上的 App Designer(使用 2017b)中绘制一些时间序列数据时遇到问题。

原始时间序列数据非常嘈杂,因此在检查 Welch PowerSpectra 后,加载的数据(用户通过 UIGetFile 选择)得到去趋势和陷波过滤(Notch 的频率来自用户输入的 UITable)单独的 UIAxes。

我可以很容易地让它在 App Designer 之外工作,但最好将它全部保存在 UIFigure 和指定的 UIAxes 中(我可以让过滤的时间序列数据显示在单独的图中,而不是在 UIAxes [有频谱图也有同样的问题])。

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
Bx1 = timeseries(Bx, t);    % Set the timeseries

FreqNotch = app.UITable.Data;              % Grab Frequencies to Notch from values entered in UITable
Bx1 = detrend(Bx,'constant');               % Get rid of the mean
ts1 = idealfilter(Bx1,FreqNotch,'Notch');  % Notch filter the data

plot(app.UIAxes, ts1);   % Doesn't work, returns error
plot(ts1);               % Does Work, just plots in a seperate figure

错误信息是:

使用绘图时出错。数据必须是数字、日期时间、持续时间或可转换为双精度的数组。

4

2 回答 2

0

根据您提供的信息,我怀疑问题出在您访问数据的方式上,在 app.designer 类中存储为“属性”的数据通常组织在单元格中。

根据我修改语法的经验,您用于访问数据(大括号、括号、点符号等)将解决此问题。

如果没有更多信息,我将无法提供更精确的解决方案(即使这个答案是在问题发生六个月后做出的)。

于 2018-10-19T21:37:00.647 回答
0

下面是我用来在应用程序设计器中的 UIAxes 上绘制缺口过滤时间序列数据的解决方案的一部分,轴上具有正确的日期和时间。这是 90 分钟块中的 1000Hz 数据(~550 Mb ascii 文件),用于 5 个单独的通道(仅在下面显示一个)。

app.Bx = app.DataLoaded(:,8); % time series data from imported text file

% set the date and time from loaded data YYYY MM DD HH MM SS MS
app.dateT = datetime(app.DataLoaded(:,1),app.DataLoaded(:,2),app.DataLoaded(:,3),app.DataLoaded(:,4),app.DataLoaded(:,5),app.DataLoaded(:,6),MilliSec);

t = 0:(size(app.Bx,1)-1);    % set the time variable from 0 to length of file
t = t/app.Frequency;         % in seconds and correct for Frequency rate 

app.Bx = detrend(app.Bx,'linear'); % removing of best straight-line fit from data
app.Bx = detrend(app.Bx,'constant'); % removes the mean value from data

FreqNotch = (app.UITable.Data);  % get the data entered in the notch table
FreqNotch = cell2mat(FreqNotch); % convert table cell to matrix

app.FilteredBx = idealfilter(app.Bx,FreqNotch,'notch'); % notch filter each

line(app.UIAxesTS1,app.dateT,(app.Bx.data),'Color',[0.27 0.87 1], 'LineWidth',0.8);

干杯,BK

于 2019-05-21T03:16:14.543 回答