Error using urlread to get results from queries

3 views (last 30 days)
Hello,
I'm doing some Freebase query (for example : https://www.googleapis.com/freebase/v1/mqlread?query={"type":"/people/person","id":"/en/albert_ii_of_belgium","children":[]})
and I want to get the result in matlab.
So I did :
urlread(https://www.googleapis.com/freebase/v1/mqlread?query={"type":"/people/person","id":"/en/albert_ii_of_belgium","children":[]})
but I had the following error :
Error using urlread (line 111)
Error downloading URL. Your network connection may be down or your proxy settings improperly configured.
I haven't got any network problem.
However, I can't figure out how to solve this problem.
My matlab version is R2012b (32 bits).

Accepted Answer

per isakson
per isakson on 13 Oct 2012
Edited: per isakson on 13 Oct 2012
Doc says:
str = urlread(URL)
where URL is a Matlab string. You need to enclose the text by apostrophes to make it a Matlab string. This call (shortened to fit in one line) works here
str = urlread( 'https://www.googleapis.com/..._belgium","children":[]}' )
str =
{
"result": {
"type": "/people/person",
"id": "/en/albert_ii_of_belgium",
"children": [
"Philippe, Duke of Brabant",
"Prince Laurent of Belgium",
"Princess Astrid of Belgium, Archduchess of Austria-Este",
"Delphine Bo\u00ebl"
]
}
}

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!