0

I'm trying to extract price values from a website for a final project. I am to create a GUI that calculates the cost of materials to build a house. I am attempting to use up to date pricing from Home Depots website each time the GUI is run. I am trying to use urlread function to extract the prices. This is what I have right now, and have been playing with.

url = 'http://www.homedepot.com/p/SHEETROCK-UltraLight-1-2-in-x-4-ft-x-8-ft-Gypsum-Board-14113411708/202530243'

SheetrockPrice = urlread(url ,'Get',{'span#ajaxPrice.pReg'})

I believe my problem is with creating the search parameters.

  • You will probably need to write your own parser to extract prices. – madbitloman Apr 16 '15 at 22:43
  • 'Get', is to specify [query string](http://en.wikipedia.org/wiki/Query_string) name-value pairs. Like @madbitloman said, you will need to parse it afterwards. – krisdestruction Apr 17 '15 at 01:07
  • What would be the best way to parse the string for the numerical value? – Carpenterguy Apr 17 '15 at 02:51
  • 1
    The best way to get your price values is to use regular expressions(regexp()) in Matlab. Couple examples are [here](http://stackoverflow.com/questions/17396902/how-to-read-only-url-from-txt-file-in-matlab) and [here](http://stackoverflow.com/questions/11126721/using-matlab-to-parse-html-for-url-in-anchors-help-fast) – madbitloman Apr 17 '15 at 04:07
  • Also to make your code working and actually get a char array use: SheetrockPrice = urlread(url ,'Get',{'ciItemPrice','url'}) – madbitloman Apr 17 '15 at 04:09
  • Is this related to http://stackoverflow.com/questions/29660967/can-matlab-retrieve-online-data? If so, didn't the answer pointing out a REST API work out for you? – A. Donda Apr 17 '15 at 14:31
  • 1
    @A.Donda I could not get an API key, unfortunately. – Carpenterguy Apr 18 '15 at 14:03
  • I am realizing I have left out a vital detail. The reason for gathering the price value is so that my price list is always up to date. That being said, the price values from the url may change. – Carpenterguy Apr 18 '15 at 14:15

0 Answers0