Problems of loading http urls in matlab.

조회 수: 4 (최근 30일)
Ray Lee
Ray Lee 2014년 8월 11일
편집: Ray Lee 2014년 8월 11일
I can access websites using the matlab web browser.
I can NOT download a url link using 'urlread'.
Is there any other matlab function to download the text of a url link?
Another alternative way is to use wget in matlab. I know how to save the url to a local text file and then read it into matlab, but it's inefficient since I have plenty of urls to read. Is there any way I can assign the wget-downloaded text to a variable in matlab straightforwardly?

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 8월 11일
Is an error being thrown when you used urlread, or is it just that the output is an empty string? What is the line of code that you are using to access the web content?
I don't have wget but (on my Mac) I use curl and can save the output from the call to a variable as per the system examples
% build the command string
cmd = ['curl ' 'http://www.mathworks.com/matlabcentral/answers'];
% execute the command
[status,cmdout] = system(cmd);
% what is the output?
cmdout
Try the above and see what happens!
  댓글 수: 4
Geoff Hayes
Geoff Hayes 2014년 8월 11일
편집: Geoff Hayes 2014년 8월 11일
I don't see that line when I run the equivalent. (I'm using MATLAB 2014a.)
Interesting that urlread('http://www.google.com','timeout',5) times out, but web('http://www.google.com') works fine (that is what you meant by MATLAB web browser?). Do you need to specify proxy server settings to connect to the internet (due to firewall perhaps)?
Ray Lee
Ray Lee 2014년 8월 11일
편집: Ray Lee 2014년 8월 11일
Yes, you are all correct.
Now all problems are fixed. Thx a lot.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by