Doug’s MATLAB Video Tutorials
December 24th, 2008
MATLAB example: Don’t reinvent the thermometer
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 “a new Matlab Central submission that uses the thermometer and a urlread of boston.com to make a new chart like that every day.”

I am not one to back away from a challenge, so here it is.
The code is fragile, but basically I am using URLREAD to bring in data from weather.boston.com. 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.

The rest was just calling the modified thermometer.m code from last week.
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?
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.
15:29 UTC |
Posted in Level: Advanced, Topic: Practical example |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
Recent Comments