ThingSpeak

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

urlFilter

Scrape numbers from web page

Syntax

num = urlfilter(URL,target,numNumbers,direction)

Description

num = urlfilter(URL,target,numNumbers,direction) returns the first number that appears after the target string, where target is the string that appears immediately before the number specified.

Examples

Retrieve the Number after a String

Retrieve the first number after the string 'Latitude / Longitude' on a specified web page.

url = 'http://www.marinetraffic.com/en/ais/details/ships/219018692';
num = urlfilter(url,'Latitude / Longitude')
num =

   36.5884

Input Arguments

collapse all

URL to scrape numbers from, specified as a string.

Example: thingSpeakRead(12397,'URL','http://api.thingspeak.com');

Target in the specified URL to scrape data, specified as a string.

Number of targets on the specified URL to read, specified as a numeric value. The argument returns a list of numbers that appear after the target string. The algorithm continues grabbing numbers until the specified numNumbers are grabbed or the call reaches end of the file.

URL read direction, specified as a string value. Valid values are 'forward' or 'backward'. The read command reads in the specified direction, starting from the target string.

Output Arguments

collapse all

Number of targets, returned as a numeric value. The command returns the first number if no optional arguments are specified.

See Also

Functions

Was this topic helpful?