Remove one data-value from data set?

34 次查看(过去 30 天)
Hi
I am running a channel logging temperatures. When I made an update to the channel and added a field. The first field for some reason got one logged data that was wrong and way off, this must have come from the channel edit I made rather than from the arduino update. Because the value is -127 and the arduino type the data is based on is unsigned.
Can I somehow remove this single data from the dataset? If so, how?
Thanks!

回答(2 个)

ME
ME 2019-10-27
It is quite difficult to help without knowing the format in which you have your data stored. But, assuming that you have an array of temperatures then you could just use:
temp(temp==-127)=[]
  2 个评论
Thomas Nilsson
Thomas Nilsson 2019-10-27
Hi
Well, I really don't know how it is stored. I write data to thingspeak as it is measured. One single item of that data is wrong, and it happened exactly when I made a change to that channel, adding a field to the settings of the channel.
ME
ME 2019-10-28
Well then I guess I’d point you to this page which discusses the same issue. Seems like it is difficult to do directly in thingspeak but can be done by exporting the data, removing your “bad” point and then importing the corrected version.

请先登录,再进行评论。


Thomas Nilsson
Thomas Nilsson 2019-10-28
I found these ways.
For the "normal" thingspeak field chart, I used the "Data min" option to filter out all values below zero. This made my faulty one disappear for this display.
For the Matlab chart, I used the following code to remove any data sample below zero. This made the faulty one disappear for the matlab display.
[data, time] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'DateRange',[datetime(2019,10,25,20,30,00),datetime(2020,10,25,20,30,00)], 'ReadKey', readAPIKey);
TF = data(:,1) < 0;
data(TF,:) = [];
time(TF,:)=[];
%% Visualize Data %%
plot(time, data);

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 Configure Accounts and Channels 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by