downloading from site using href

177 views Asked by At

I'm sure that this is a very simple matter, but I don't have the necessary knowledge to deal with it. I did search extensively, and could not find any solution - this is likely because I'm not even sure about what specifically to look for and study. :-/

I'm trying to download a csv file into matlab, from this URL: http://www.fangraphs.com/projections.aspx?pos=all&stats=pit&type=rzips&team=0&players=0

Clicking on the "Export Data" link that is on that page does download a csv file that I can then import into matlab manually without a hitch. I would like to avoid the whole "manual download" part of the process, and have matlab read it instead.

If I peek into the page source, the "Export data" link looks like this: href="javascript:__doPostBack('ProjectionBoard1$cmdCSV','')

How do I download this csv file into matlab? Can I harness urlread to do this for me? If so, how? Even just a pointer to the right resources to look into would be tremendously helpful...

Thanks in advance to whomever will answer!

1

There are 1 answers

1
AudioBubble On

Based on your question, it sounds like you don't really need code for it at all.

unless you really need a code solution, I personally would just add matlab as the default handler for CSV files, so I can open it directly from the link.

2 steps:
1) tell you browser to use matlab as the handler for CSV files: Chrome instructions here: (All major browsers have similar capabilities) http://productforums.google.com/forum/#!topic/chrome/ynjN66lLg2U

2) Tell you browser to autorun that type of link: (again answer in this case is for chrome, but all major browsers have similar capabilities) http://blog.rubbersoft.com/2010/01/how-to-automatically-open-downloaded-files-in-chrome/