How to extract locations from strings of addresses?

2 ビュー (過去 30 日間)
pietro 2019 年 1 月 10 日
編集済み: Stephen23 2019 年 1 月 13 日
Hi all,
I have more than a thousand of strings containing addresses. How can I programmatically extract the locations, like cities (e.g. Rome, London, etc) and countries (e.g. Italy, UK, etc)?
  8 件のコメント
pietro 2019 年 1 月 13 日
Hi Akira,
thank you for the answer. Well, it is a good solution. I think I might adopt it.



Stephen23 2019 年 1 月 13 日
編集済み: Stephen23 2019 年 1 月 13 日
Using one simple regular expression:
>> C = {...
'Sustainable Industrial Systems, School of Chemical Engineering and Analytical Science, The University of Manchester, Manchester, United Kingdom; Dipartimento di Scienze Agrarie e Ambientali - Produzione, Territorio, Agroenergia, Università degli Studi di Milano, Milan, Italy';
'Department of Agricultural and Environmental Sciences - Production, Landscape, Agroenergy, Università degli Studi di Milano, Via G. Celoria 2, Milano, Italy; Department of Earth and Environmental Sciences, University of Milano-Bicocca, Piazza della Scienza 1, Milano, Italy';
'Department of Land and Agriculture and Forestry Systems, University of Padua, Viale dell''Università 16, 35020 Legnaro (PD), Italy';
'Dipartimento di Agraria, University of Sassari, Sassari, Italy'};
>> M = regexp(C,'[^,]+,[^,]+(?=;|$)','match');
>> M{:}
ans =
' Manchester, United Kingdom'
' Milan, Italy'
ans =
' Milano, Italy'
' Milano, Italy'
ans =
' 35020 Legnaro (PD), Italy'
ans =
' Sassari, Italy'

その他の回答 (0 件)


Find more on Gas Dynamics 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!

Translated by