get name in struct type

조회 수: 1 (최근 30일)
MIHYUN
MIHYUN 2014년 7월 8일
댓글: Jan 2014년 7월 8일
Hi. I want to get country and locality name using coordinate(latitude & longitude)
%%
Lat = 48.858370;
Lon = 2.294481;
base_url =[ 'http://maps.googleapis.com/maps/api/geocode/json'];
formatSpec = '%4.6f';
LatLon = [num2str(Lat,formatSpec),',',num2str(Lon,formatSpec)];
request_url = [base_url '?latlng=' LatLon '&sensor=true_or_false']
docNode = urlread(request_url);
data = json.load(docNode)
This is matlab code.
For example, Latitude = 51.501261, Longitude = -0.127768
Country is United Kingdom , Locality is London
I want to get the name 'United Kingdom'and'London"
How to get the name?
  댓글 수: 1
Jan
Jan 2014년 7월 8일
I do not have a function to run "json.load". So the only interesting detail is the format of the output "data". Could you post this in detail?

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

답변 (1개)

Michael scheinfeild
Michael scheinfeild 2014년 7월 8일
fieldnames
  댓글 수: 1
MIHYUN
MIHYUN 2014년 7월 8일
I used fieldnames, but the desired result was not out.
A = data.results(1,9).types(1,1);
name = fieldnames(A)
types is cell type.
In the cell , Is there a function the same as fieldnames ?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by