Search code examples
javamatlaburlread

reading an html with matlab


I would like to read some html using matlab. I've already tried urlread but got the url read error

Getting data into MATLAB from HTTPS:

so i tried using java with this:

Handling an invalid security certificate using MATLAB's urlread command.

unfortunately i don't know how to use java with matlab. so i tried this code and it seems to work

  url = 'https://stackoverflow.com/questions/11053664/use-java-in-matlab';
  is = java.net.URL([], url ).openConnection().getInputStream(); 
  br = java.io.BufferedReader(java.io.InputStreamReader(is));
  str = char(br.readLine());

however i would like to get the whole html page. so i can use regexp. My kingdom for some help


Solution

  • There is a function in matlab that does that... The name is urlread!

    See http://www.mathworks.com/matlabcentral/answers/973