Remove one data-value from data set?

49 visualizzazioni (ultimi 30 giorni)
Thomas Nilsson
Thomas Nilsson il 27 Ott 2019
Risposto: Thomas Nilsson il 28 Ott 2019
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!

Risposte (2)

ME
ME il 27 Ott 2019
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 Commenti
Thomas Nilsson
Thomas Nilsson il 27 Ott 2019
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 il 28 Ott 2019
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.

Accedi per commentare.


Thomas Nilsson
Thomas Nilsson il 28 Ott 2019
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);

Community

Più risposte nel  ThingSpeak Community

Categorie

Scopri di più su Configure Accounts and Channels in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by