2

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!

Shai
  • 111,146
  • 38
  • 238
  • 371
  • maybe [this question](http://stackoverflow.com/questions/1311106/running-a-javascript-command-from-matlab-to-fetch-a-pdf-file) is related? – Shai Jun 09 '14 at 08:04

1 Answers1

1

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/

  • Thanks for your suggestion, but I really need a way to avoid having to open the link from my browser, so a code solution is what I'm looking for. – user2686629 Aug 16 '13 at 22:13