import data from the web?

조회 수: 6 (최근 30일)
Chad Greene
Chad Greene 2012년 6월 12일
Hi friends,
I'd like to import the data found here: http://geoid.colorado.edu/grace/data/data-30i5bio0a9vng04vriclc97976-0005.txt, but Matlab chokes on it. When I view the data in a web browser it looks like three nicely-formatted columns, but if I save it and open in Notepad, the formatting is not evident. Ideas?
Thanks!

답변 (2개)

JPVersiani
JPVersiani 2012년 6월 12일
You can do the following: copy and paste from own browser, or save the file and use excel to open it. Open Excel and go to open, change the option to file for'' all files'' and choose the text file, then just define the columns of data and delete the text. Good luck!
  댓글 수: 1
Chad Greene
Chad Greene 2012년 6월 12일
I was afraid of that. I'd prefer to remove the manual copy-paste-save steps if possible. If I hand my code off to a colleague, fewer steps are always better. Easier to learn and fewer places to introduce error. The simplest solution I have found is to save the .txt file as an .asc file, then import using importdata('gracedata.asc'). I'm open to other suggestions.

댓글을 달려면 로그인하십시오.


Sean de Wolski
Sean de Wolski 2012년 6월 12일
You could always use urlread and then post process the string:
str = urlread('http://geoid.colorado.edu/grace/data/data-30i5bio0a9vng04vriclc97976-0005.txt');

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by