How can I make urlread faster / problem using urlread2?

Hello,
I am using old Matlab 7 and been struggling with urlread-function. It is painfully slow.
A=urlread('http://www.mathworks.com') takes about 700ms and it is just 35000 characters long. Basically smaller or larger webpages take between 700 and 900ms to read, so this is not about the speed of the internet connection.
I also read about the improved urlread2-function, but could not get it working. I downloaded this
and copied all files to a folder. When running
A=urlread2('http://www.mathworks.com')
It gave this error
Error in ==> urlread2 at 144 assert(usejava('jvm'),'Function requires Java')
OK, I found the assert.m function online and copied it to the folder too. Now this error appeared:
??? Undefined variable "com" or class "com.mathworks.net.transport.MWTransportClientPropertiesFactory.create".
Error in ==> urlread2>getURLConnection at 360 mwtcp = com.mathworks.net.transport.MWTransportClientPropertiesFactory.create();
Error in ==> urlread2 at 151 urlConnection = getURLConnection(urlChar);
Any idea how I could get urlread2 working or make urlread faster? Any help in this problem is greatly appreciated. Thank you so much in advance.

댓글 수: 2

If you run the following in the Command Window
usejava('jvm')
what is the result? (I'm guessing that it is zero.) Also, what does
version -java
return? (This returns the version of the Oracle® JVM™ software that MATLAB is using.)
usejava('jvm') returns 1 and the java version is:
Java 1.4.2 with Sun Microsystems Inc. Java HotSpot™ Client VM (mixed mode)

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

답변 (1개)

per isakson
per isakson 2014년 8월 4일
편집: per isakson 2014년 8월 4일
With R2013a,64bit,Win7 and a "fast" Internet connection.
>> tic, A=urlread('http://www.mathworks.com'); toc
Elapsed time is 0.763045 seconds.
>> tic, A=urlread('http://www.mathworks.com'); toc
Elapsed time is 0.769103 seconds.
>>
>> usejava jvm
ans =
1
>> version -java
ans =
Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
http://www.speedtest.net/ says my download speed is 720Mbps

댓글 수: 3

So this basically confirms what I suspected: urlread is generally slow regardless of the computer/matlab setup you are using. You can find people complaning about that online.
The next questions are then:
1) are there ways to speed-up urlread? 2) is urlread2 faster? 3) if yes, why doesnt urlread2 work in my first post here?
per isakson
per isakson 2014년 8월 4일
편집: per isakson 2014년 8월 4일
  1. ask at Expanding urlread capabilities
  2. I cannot find any claims that urlread2 should be faster.
hi, can I ask if you have solve the problem, does it read faster than urlread?

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

카테고리

도움말 센터File Exchange에서 Call Java from MATLAB에 대해 자세히 알아보기

질문:

2014년 8월 4일

댓글:

2017년 6월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by