URLFilter | MATLAB | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
URLFilter
Avatar
mircasam
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
February 1, 2016 - 12:06 pm
sp_Permalink sp_Print

Hi everyone:
I´m suffering fails on URLFILTER command, I´ve used an analysis to calculate some variables that uses URLFILTER to get data from a webpage, It worked fine for last 3 months, but now, from three weeks ago, it´s failing at random.
Sometimes work fine, sometimes fails, by the way, I don´t receive email informing failed.
https://thingspeak.com/channels/56115
In private view I have mora data and graphics, but as seen in other topics, can´t make them public.
Does anybody realized this behaviour?
Thanks in advance.
B.R.

Avatar
Hans
Natick, MA

Forum Posts: 390
sp_UserOfflineSmall Offline
2
February 1, 2016 - 1:24 pm
sp_Permalink sp_Print

We will look into the issue with URLFILTER. We have not had any complaints wider than yours, but we will investigate.

What kind of analysis are you doing?

Thanks for joining the ThingSpeak Community!

Hans

Avatar
mircasam
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
3
February 2, 2016 - 8:21 am
sp_Permalink sp_Print

Dear Hans:
I have a Matlab Analisys that makes a request through a ThingHTTP that consults Openweather page to retrieve Wind Speed (I have an authorised Acces to Openweather through my API).
The rest of the analisys calculates Dew Point, Wind chill, cloud base level and some other params.
As I said before, It worked fine since three months ago, but now (from three weeks ago) I notice that the charts were no updating the calculated parameters, so go to the Analisys page and found:
"Error using urlfilter
Target string speed does not appear"
I tried the ThingHTTP request pasting the URL directly on Chrome and works fine.
Thanks a Lot.

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
4
February 3, 2016 - 11:55 am
sp_Permalink sp_Print

Hi,

Thanks for the additional information. URLfilter function parses through the http response to find the target string 'speed'. Once it finds the word 'speed' it finds the first number occurring after.

We haven't changed the URLfilter function since we introduced it. Therefore, my suspicion is that the response from Openweather might sometimes not contain the word 'speed' in it and therefore URLfilter generates an error.

If this doesn't resolve the issue, tell me more about how you are using URLfilter function with ThingHttp in your MATLAB Analysis App.

Thanks,
Adarsh

Avatar
mircasam
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
5
February 3, 2016 - 3:58 pm
sp_Permalink sp_Print

Hi,
I´ve been making some test, and I think you´re right.
I make a call to Openweather.org throgh ThingHTTP:
https://api.thingspeak.com/apps/thinghttp/send_request?api_key=6EBVWEE0FCM6TXU9

If you paste literally in your browser you would receive a text (maybe JSON) with the response, but I found that sometimes, fails, so URLFILTER cannot find the string.

More or less, every two or three times you request from Openweather fails.
Example of right response:
{"coord":{"lon":-3.86,"lat":40.73},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"base":"cmc stations","main":{"temp":274.17,"pressure":932.87,"humidity":82,"temp_min":274.17,"temp_max":274.17,"sea_level":1051.18,"grnd_level":932.87},"wind":{"speed":3.02,"deg":9.0007},"clouds":{"all":0},"dt":1454530522,"sys":{"message":0.0025,"country":"ES","sunrise":1454484198,"sunset":1454520947},"id":3117503,"name":"Manzanares el Real","cod":200}

Example of wrong response:
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
Obviously in this response,URLFILTER cannot find string "speed"so fails...
I´ll try to contact to Openweather.org. anyway if matlab analisys could not stop trying to parse, probably on second try it will work.
Maybe it would be a good evolution for URLFILTER function, or maybe a max number of errors before failing.
And I´m still waiting for the email informing the fail... I used to receive it.

Thank you very, very much!
I´ll try to inform you about Openweather issue.
B.R.
Miro

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
6
February 4, 2016 - 10:57 am
sp_Permalink sp_Print

One option to avoid errors in MATLAB for known conditions is to use the Try-Catch construct:

http://www.mathworks.com/help/matlab/ref/try.html

If you want the code to do nothing when URLfilter does not find 'speed', leave the Catch portion empty:

try
urlfilter()
catch
end

This will keep the MATLAB code running.

You can also nest try-catch constructs, i.e.,

try
% First attempt
urlfilter()
catch
try
% Second attempt
urlfilter()
catch
end
end

This allows you to call urlfilter twice and it also prevents your MATLAB Analysis app from erroring even if on both attempts 'speed' data is missing.

We are looking into the email issue and will get back soon.

Thanks,
Adarsh

Avatar
mircasam
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
7
February 7, 2016 - 5:04 pm
sp_Permalink sp_Print

Dear Adarsh:
If you leave thingspeak alone, don´t mind if matlab says that code contains an error, everything works fine!
As we spoke, error only happens once every two or three times, so sometimes when you find the error message in the matlab analisys, maybe next time the analisys runs, it works. And that´s it right.
It´s working correctly since Thursday, maybe some updates are not correct, but doesn´t mind, at the end it´s no so important if you miss a data in hundreds.
Thank you very much.
Best Regards.
Miro.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

dannymm1

KamorkasOr

GRV2903

Jusikaclaiz

Raymondpoers

ScottDus

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee