Error using urlread to get results from queries

2 次查看(过去 30 天)
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).

采纳的回答

per isakson
per isakson 2012-10-13
编辑:per isakson 2012-10-13
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"
]
}
}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by