{"id":344,"date":"2008-12-24T15:29:43","date_gmt":"2008-12-24T15:29:43","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/2008\/12\/24\/matlab-example-don%e2%80%99t-reinvent-the-thermometer\/"},"modified":"2016-04-04T12:57:49","modified_gmt":"2016-04-04T17:57:49","slug":"matlab-example-don%e2%80%99t-reinvent-the-thermometer","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2008\/12\/24\/matlab-example-don%e2%80%99t-reinvent-the-thermometer\/","title":{"rendered":"MATLAB example: Don\u2019t reinvent the thermometer"},"content":{"rendered":"<p>My <a href=\"https:\/\/blogs.mathworks.com\/videos\/2008\/12\/18\/matlab-example-dont-reinvent-the-wheel\/\">last post<\/a> talked about finding MATLAB code from other people so that you do not have to reinvent it yourself. Eric, the author of the code I modified, challenged me to create &#8220;a new Matlab Central submission that uses the thermometer and a urlread of boston.com to make a new chart like that every day.&#8221;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/videos\/..\/images\/videos\/2008\/12\/xmaseveweather.jpg\" alt=\"MATLAB Weather in Boston\" \/><\/p>\n<p>I am not one to back away from a challenge, so here it is.<\/p>\n<p>The code is fragile, but basically I am using URLREAD to bring in data from <a href=\"http:\/\/www.boston.com\/weather\/\">http:\/\/www.boston.com\/weather\/<\/a>. Once I have the data, I use regular expressions to bring in the data I want. I basically came up with the regular expression by finding the html surrounding the data I was interested in. From there I captured my tokens.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/videos\/..\/images\/videos\/2008\/12\/regexp.jpg\" alt=\"MATLAB RegExp\" \/><\/p>\n<p>The rest was just calling the modified thermometer.m code from last week.<\/p>\n<p>I say this is fragile because it is relying on the website keeping the same format. If they change much of anything, this will break. However, until that happens, this is a nice little visualization that shows how you can make just about anything into a datafeed. Are there websites, internal or otherwise, that you would like to have MATLAB read from?<\/p>\n<p>Blog readership goes down significantly over the winter holidays, so I will be taking a week off. I will talk to you all again after the turn of the New Year.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My last post talked about finding MATLAB code from other people so that you do not have to reinvent it yourself. Eric, the author of the code I modified, challenged me to create &#8220;a new Matlab&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2008\/12\/24\/matlab-example-don%e2%80%99t-reinvent-the-thermometer\/\">read more >><\/a><\/p>\n","protected":false},"author":68,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,20],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/344"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":2118,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/344\/revisions\/2118"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}