Remove one data-value from data set?

조회 수: 12 (최근 30일)
Thomas Nilsson
Thomas Nilsson 2019년 10월 27일
답변: Thomas Nilsson 2019년 10월 28일
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 커뮤니티

카테고리

Help CenterFile Exchange에서 ThingSpeak에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by